Web Hosting Talk







View Full Version : CSS "Import" or "Link href"????


spiderwebfx
07-23-2007, 06:20 PM
Ok, so I was looking at a source for a website, and noticed how the CSS was pulled into the document. It was done like this:

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

Now, I myself have done in quite differently, like this:

<style type="text/css" media="all">
@import "stylesheet.css";
</style>


So the question is, which is the right way to do it? Or if they are both right, which is the best one to use?

Jay August
07-23-2007, 06:26 PM
they are both right and supported. http://htmlhelp.com/reference/css/style-html.html

spiderwebfx
07-23-2007, 06:29 PM
Is there actually any difference of what it does, apart from the way it is written?

Jay August
07-23-2007, 06:30 PM
http://www.w3.org/TR/REC-CSS2/cascade.html#at-import

spiderwebfx
07-23-2007, 06:32 PM
Ahh... Thanking you very much :D

Jay August
07-23-2007, 06:36 PM
you're welcome :) next time you got a HTML/CSS related question, ask w3.org ;) Although one of the most boring websites, they do have a very powerful search engine!

spiderwebfx
07-23-2007, 06:39 PM
Ahh Ok. I shall keep that in mind. They have proven to be very useful to me with there validator's so far. Just got two bored to look at anything else there.

Jay August
07-24-2007, 01:12 PM
Not hard to believe, that must be the most boring website on the net :) I do like their PageRank though :)