<style> or <link> in the <body> ??? RRS feed

  • Question

  • Everybody does it; Google, Yahoo, WSJ. When you have a large site, (lots of modules loaded at users discretion), you either emit the css in the head for all possible modules and dynamic content, or don't and let the module carry the css. Some CMS sites that attempt to keep all the CSS definitions in the head end up emitting 80K bytes of CSS on every page even when the actual code is very small.

    So, I'm dirty. I'm loading my CMS modules with links to small css files appropriate for only that module. They load after the head has been emitted. I know, it beaks the rules however it works. Every browser I've tested has no problem with it. Even IE6.

    Is there a question here? Yes -> So if everybody is doing it, and all the browsers support it, why is it not become part of the XHTML standard? It's no different than littering your pages with <script> tags which is legal.


    Sunday, November 21, 2010 6:50 PM

All replies

  • Well, one reason may be that they stopped working on XHTML a year ago in favor of HTML5 and were winding down well before that, so it's probably been at least 2 years since anything substantive was done with XHTML.

    All sorts of stuff is possible on the web, even without being best practice. Look at MSNBC.com--no DOCTYPE. Never had it, and that was a conscious decision when they upgraded their site 4 or 5 years ago--lots of discussion on the boards about it. They acknowledged the value of stating it but didn't because all of their old content would break.

    2010 is the 75th anniversary of Schrodinger's Cat. Hmmm...Do I buy a present or not?
    Sunday, November 21, 2010 7:10 PM

  • 2010 is the 75th anniversary of Schrodinger's Cat. Hmmm...Do I buy a present or not?

    Yes. You buy a present. Or not...

    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.
    Sunday, November 21, 2010 8:04 PM
  • Well Bill, I wasn't asking about a specific standard I guess. Semantically HTML4.01 = XHTML 1.1 and I was assuming that someday HTML5 will be aka XHTML 2.0 or some such. What I meant by XHTML was what ever the current standard was, hence the X.
    Sunday, November 21, 2010 8:14 PM