0

Inline CSS works, but when I link it doesn't.

It happned in Firefox 3.something and in IE8.

template1.html

<html>
<head>
<title>title here</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="..." />
<meta name="description" content="..." />
<link ref="stylesheet" href="body.css" type="text/css" />
<style type="text/css">
/* Here it works
body {
	background-color: blue;
}
*/
</style>
</head>
<body>
<div id="container">
</div>
</body>
</html>

body.css

body {
	background-color: blue;
}
3
Contributors
7
Replies
10
Views
5 Years
Discussion Span
Last Post by tivrfoa
0

Well then I would guess it's a file path issue. Is your stylesheet(body.css) in the same folder as your index page? Or is it in another folder, and you didnt point to it in your link. Also, not sure it matters, but just for the sake of clarity, I dont normally name my files with names that correspond to tags or page elements like "body". Again, I doubt it hurts anything, but just my preference.

Can you post a live link to your site?

Edited by teedoff: n/a

0

Well then I would guess it's a file path issue. Is your stylesheet(body.css) in the same folder as your index page? Or is it in another folder, and you didnt point to it in your link.

It's in the same folder. I can even click in the CSS link when I show the source code in Firefox 3.6.10.

0

Well again, we cant guess at it if you dont provide your full code or a LIVE LINK to your site.

0

Did you actually upload it to your site? It is not embedded in the page and has to be uploaded separately.

Can you give us a live url to look at?

Also you don't have a doctype in your code, and that is a very risky way to build your pages.

PS I agree that it is a bad idea to use a reserved word like body for anything purpose other than its intended reserved purpose. It's just good working practice in all computing to treat reserved words with respect.

0

Well again, we cant guess at it if you dont provide your full code or a LIVE LINK to your site.

The full code was provided, and I don't have a site.
I just want that someone else copy this code and try to run it in his machine to see if it works.

1

ok I see a spelling error in your stylesheet link!

<link ref="stylesheet" href="body.css" type="text/css" />

Should be:

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

You should also add a valid doctype if you expect cross browser compliance.

Edited by teedoff: n/a

0

ok I see a spelling error in your stylesheet link!

thank you! You see. I just needed that someone tested the code. xD I think the rel property wasn't necessary in the past, but if I remove it, it doesn't work.

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.