views:

225

answers:

4

Okay, what is Amazon doing? They put all their CSS definitions in the <head> tag? I can see the purpose of saving requests, but it doesn't seem very dynamic to me.

Any ideas?

+4  A: 

The <head> element is traditionally the place for CSS files because the browser will download the files at the beginning of the request.

Andrew Hare
I think he refers to the fact that they don't use a link-tag but directly embed the css via style-tag
jitter
+2  A: 

For me it makes sense. Amazon is a high traffic website and reducing request is surley a good thing for them.

Why shouldn't it be dynamic? Where is the difference between including the CSS or including it via a link tag.

jitter
You're right. Poorly put by me.
David Andersson
-1, on the other hand, you cannot cache the css then, so the size of the responses augment which definitely affect your bandwidth. Note that with a correct expiry date, you'll have the same effect (less requests) with less costly pages. So I suppose there is another reason....
Matthieu M.
+1  A: 

That's very likely not hard-coded in there. It's probably more dynamic than you think. I don't know what set-up Amazon has, but I'm guessing they're using some sort of templating language to add those styles dynamically.

peirix
Okay, sorry, on closer examination they do have a lot of `<link>`'s there. Very plausible, thanks.
David Andersson
+1  A: 

Putting the css on other place then head will trigger a rerendering of the side in some browsers. So if you put your css at the bottom of the page you get an unstyled page until the css is loaded and then the whole page will be rendered again with the new style rules. http://developer.yahoo.com/performance/rules.html#css_top

eskimoblood