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

> 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 UTC