0

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?

4
Contributors
5
Replies
26
Views
3 Years
Discussion Span
Last Post by david.roun.7
0

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.

0

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.

1

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.

1

<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">

0

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).

Edited by david.roun.7: added the last comment

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.