HighDots Forums  

Re: Does style declarations order matter?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: Does style declarations order matter? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: Does style declarations order matter? - 01-27-2006 , 03:02 PM






On Fri, 27 Jan 2006, Claude Schneegans wrote:

Quote:
Is it specified somewhere in the docs that pseudo styles for links
should be given in any specific order,
Not directly, but it's usually explained in tutorials.

Quote:
and why?
Application of logic to the rules set out in the specifications :-}

Quote:
In the code below, the link in the blue paragraph becomes red when
the mouse passes over, but the A:hover spec is simply ignored if it
is not the last one.
For selectors from the same source and of equal specificity, the last
takes priority. Something like that, anyway - don't ever believe what
Usenet tells you - treat it as potentially misleading clues, verify it
at the source. In this case the CSS spec cascading rules.

What the usual tutorials omit to mention is that selectors like
a:hover *will* select <a name="foo">bar</a>, which probably isn't what
you'd intend.

One hunch is that those who wrote the tutorials had only used MSIE,
which doesn't implement :hover to specification. Or maybe they
thought that use of <a name=...> had already been phased out, and
nobody had any legacy documents to which they were applying CSS. OK,
maybe you're in that lucky situation; but some of us have been doing
HTML since 1994-ish, and doing CSS since its early drafts (thanks to
the Arena browser), and have all kinds of legacy stuff to take into
account.

I do think the tutorials might mention a:link:hover (and optionally
a:visited:hover) as being more robust ways of selecting links without
accidentally affecting also anchors. You might want to style :active
too, and possibly even :focus, by the way.

There's a crazy mnemonic, "Las Vegas Forest Has Animals", to remember
an appropriate sequence for them. But that's not set in stone: it
rather depends on what you want to happen in the various scenarios.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.