tags:

views:

29

answers:

2

Hi, I have a small CSS file with contents:

<style type="text/css">

li {
padding: 10px;
font-family:  Arial;
}

</style>

Supposed to leave some space between list elements and change the font. Now, If I include this CSS file in the HTML like below:

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

it does not work :(.

However, if I include the actual CSS code inside the html "head" block, it works.

I really prefer sourcing CSS (so different files can share the code). Any idea whats wrong and how to fix?

regards, JP

A: 

You shouldn't use script tag in your css files. Just li {..} is enough.

Also, checking path (./css/lists.css) might help. If it has mistake, nothing will be included.

Nikita Rybak
Path was correct (one nice way to check is view source in browser, and then click the css href link to see if its broken). However, as you pointed out, the problem was the extra scrip tag. Removed it and the script works now :)
JP19
+1  A: 

You are supposed to omit the

<style type="text/css">

and

</style>

tags from your .css files, as those are tags used only in HTML to denote CSS styles if you're including them in your page <head>. If you include them, the browser will attempt to treat them as CSS code, which it isn't, and that causes your stylesheet to not work.

BoltClock
This works! Thanks!
JP19