W3C home > Mailing lists > Public > www-html@w3.org > April 2003

Re: Scope of the <link> tag (specifically the scope of CSS style sheets)

From: David Woolley <david@djwhome.demon.co.uk>
Date: Fri, 4 Apr 2003 21:03:49 +0100 (BST)
Message-Id: <200304042003.h34K3nh03617@djwhome.demon.co.uk>
To: www-html@w3.org

> extension to the <style> tag, it always seemed slightly unusual that
> while you can link an external script file in using <script> that it is
> not the <style> tag that is used to reference an external CSS style
> sheet (but that is a whole other discussion!).

I think that is because script was forced on the language by the browser
developers, whereas style came from W3C!  I.E. it is the script usage that
is anomalous.

> <link rel="stylesheet" type="text/CSS" href="menu.css">
>   <my menu html>
> </link>

This effect can already be achieved by:

<style type="text/css">
div.menu element etc {....}
</style>

<div class="menu">
   &MyMenuHTML;
</div>

And this has the distinct advantage that the user, who is always supposed
to have last say on styling (user !important overrides author !important,
for this reason) is not put at a disadvantage as the result of the author
having a mechanism that is not available to the user.

It's also better in that, if, like the above, you use classes, you can
consistently use the same styling throughout the document.  (You don't 
need the div in the selector, and you could have #mymenu, and id="mymenu".)

Finally, note that using link for external style sheets is obsolescent,
as XML languages, more correctly, use a processing instruction to 
specify the style sheet.
Received on Friday, 4 April 2003 16:32:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:54 GMT