Ok, so here is the CSS code in an external sheet:

#header{
position:fixed;
width:100%;
height:15%;
}
#hedr{
position:fixed;
height:5%;
width:6%;
top:5%;
left:30%;}
#nme{
position:fixed;
font-size:400%;
top:3%;
left:10%;
}

Here is the php document:

<!DOCTYPE HTML>
<html>
<head>
<meta name="keywords" content="Roun, David Roun, Rounsworld, Heather Roun">
<meta name="description" content="Personal website">
<meta name="author" content="David Roun">
<meta charset"UTF-8">

<link rel="stylesheet" type="text/css" href="bground.css">
</head>
<body>
<?php session_start();?>
<div id="header">
<table>
<tr><td><img id="hedr"  src="pages/<?php echo $_SESSION['name'] . '/' . $_SESSION['picture'];?>"/></td><td id="nme"><?php echo $_SESSION['name'];?></td></tr>    
</table>
</div>
</body>
</html>

The problem is that the CSS code works when it is on the same page as the php file, but when I try to use it as an external sheet, the page ignores it and displays the picture full page. I tried it in the same folder, and in a different folder (originally) and had the CSS code checked, so I know it's not the code. Any thoughts?

Recommended Answers

All 5 Replies

If the code runs when it is inline but not when it is separated the <link> must be the problem. Can you confirm the file name, bground.css, is correct.
The only think left must be a simple mistake.

That't what I thought and checked 4 times. I may just need to keep it on the same page but I want that to be the background for multiple pages and don't want to have to keep using the same code. Tried to attach a screenshot of the folder but couldn't.

If you use your browser's dev tools (typically by hitting the F12 key), you can click on the Console tab. If there are errors related to loading the external style sheet, the error will be listed there.

<link rel="stylesheet" type="text/css" href="bground.css">

A lot of times when that doesn't work for me, I would put the css file in a server and then rewriting it as: <link rel="stylesheet" type="text/css" href="http://yoursite.com/css/bground.css">

Ok, so here is what it says in the console:

Resource interpreted as Image but transferred with MIME type image/tiff: "http://localhost/website/pages/n/larva%20%20Keara.tiff".

So, I changed the image to a jpg and changed the pointer in the database. That note went away but this remained:

GET http://localhost/website/bground.css 404 (Not Found)

<!DOCTYPE HTML>
<html>
<head>
<meta name="keywords" content="Roun, David Roun, Rounsworld, Heather Roun">
<meta name="description" content="Personal website">
<meta name="author" content="David Roun">
<meta charset"UTF-8">

<link rel="stylesheet" type="text/css" href="bground.css"> <!---this is where the CSS file is being called---!>
</head>
<body>
<?php session_start();?>
<div id="header">
<table>
<tr><td><img id="hedr"  src="pages/<?php echo $_SESSION['name'] . '/' . $_SESSION['picture'];?>"/></td><td id="nme"><?php echo $_SESSION['name'];?></td></tr>    
</table>
</div>
</body>
</html>

It worked right when I put the full path in but I'm wondering if there is another fix (I'm lazy).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.