Forum Moderators: not2easy

Message Too Old, No Replies

Big sites like to use in-page css?

         

foxfox

10:54 am on Jan 14, 2007 (gmt 0)

10+ Year Member



e.g. [yahoo.com...]

heavy css styles have been declared at the top of the page, i really wonder why they would like this method?

for example,

1. inpage css is difficult to share -> waste bandwidth
2. broswer can't use multi-thread to download the files -> slow page rendering

anything i missed?

mattur

11:25 am on Jan 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yahoo's homepage is a special case. It would appear most styles are unique to that page, so using an external style sheet would be of little benefit.

Performance-wise an external CSS file requires another HTTP request and server hit, so for stand-alone, high traffic pages like this, inline styles may be best, fastest option.

cmarshall

3:28 am on Jan 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mattur has a good point, and is probably the real answer.

Another is that server side languages like JSP, PHP and ASP can sometimes be more efficient if they create their "on-the-fly" styles per page.

foxfox

2:29 pm on Jan 15, 2007 (gmt 0)

10+ Year Member



generate style by php will be more efficient?

cmarshall

2:40 pm on Jan 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



generate style by php will be more efficient?

It is often easier for the PHP, but not necessarily for the browser or the server.

I don't think it is especially good programming practice to do it this way, but many programmers, especially those working on large systems, do this kind of thing. It is easier to write their own local code than to look up and use a global tool.

This usually indicates that there is not such a good development support infrastructure. I run a software development shop, so I can attest to how difficult it is to prevent this kind of coding.