Previous Message
Next Message

Re: [css-d] ANNC: Correctly Using Titles With External Stylesheets

Sent by Eric A. Meyer on 5 January 2003 20:08


At 17:15 +0100 1/5/03, Stefan Huszics wrote:

>I think that article severly exagurates the dangers with using title.
>( http://devedge.netscape.com/viewsource/2002/preferred-stylesheets/ )

    Why?  It describes what happens if you use 'title' incorrectly. 
That's not exaggeration so much as it is description.  Now, had I 
said, "Never EVER use 'title' for fear of breaking all your Web pages 
forever!  Booga booga booga!" that would have been exaggeration.

>For starters, the examplecode used
><link type="text/css" rel="stylesheet" title="Basic styles" href="basic.css">
><link type="text/css" rel="stylesheet" title="Fish and boats" 
>href="ocean.css">
>
>Well, that is incorrect coding in error with the specs and thus 
>unsurprisingly it might give problems in browsers.

    The above two lines validate in an HTML 4.01 Strict document; I 
just tested this again to be certain.  Sure, HTML 4.01:14.3.1 says 
that authors "may specify that one of the alternates is a preferred 
style sheet," which implies that the above is in error.  It is, 
however, possible to accidentally mark multiple stylesheets as 
preferred, which means the user agent has to pick one and ignore the 
others, and have it validate.   This may be a failure on the part of 
the HTML validator, but someone had to explain the situation, so I 
did.  (One of the benefits of my job is that I can document obscure 
corners of the specification, and how those corners can get authors 
into trouble-- like how the CSS line box model can cause unexpected 
gaps under images, for example.)

>Every time you make a coding error you are possibly making your page 
>unusable in browsers (and often enough using correct code will also 
>break in buggy browsers). People shouldn't be scared off from using 
>features, but instead educated about how to use them correctly.

    Which I was, in fact, trying to do.  I think somewhere in the text 
it attempts to get across the point that if you use 'title', you 
should understand how to use it.  And if the validator flagged that 
sort of markup as being in error, I wouldn't have even bothered to 
write the note.

>Otherwise Eric, your next article should perhaps be about how using
>
><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
><meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
>
>can break webpages in browsers too ;)

    As soon as we start seeing Web sites doing that sort of thing, 
I'll definitely consider writing a technote on the topic.  I only 
wrote the one about 'title' because we've gotten a number of Bugzilla 
reports about "Mozilla is ignoring some of my stylesheets" and the 
cause turned out to be the incorrect over-use of 'title'.  I have 
this silly habit of trying to write material that addresses the 
problems I see people run into in the real world-- or at least a 
piece of it.  In fact, it's my primary criterion for writing DevEdge 
pieces.

>Also the article doesn't mention any of the benefits of using title

    When I get to write an article on using alternate stylesheets 
(which will probably happen whenever Mozilla makes alternate-style 
choices persistent for a site), I'll definitely explore the utility 
of the 'title' attribute as a part of that piece.  In the meantime, 
of course, you're free to write your own piece on the topic (or 
anything else CSS related) and announce it here.

--
Eric A. Meyer (http://www.meyerweb.com/eric/), List Chaperone
"CSS is much too interesting and elegant to be not taken seriously."
   -- Martina Kosloff (http://www.mako4css.com/)
Previous Message
Next Message

Message thread:

Possibly related: