469,946 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

Eric Meyer on CSS: link style order

Hi everyone,

Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must be
added in LVHA order (link, visited, hover, active) or link styles will
stop working. Why is that? Is there an automatic inheritance from Link
--> Visited --> Hover --> Active?

Thanks,

Jamie
Jul 20 '05 #1
7 6610
Jamie <en***********@yahoo.com> wrote:
Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must be
added in LVHA order (link, visited, hover, active) or link styles will
stop working.
The order of LV isn't important, the order of HA is only of minor
importance; but HA must come after LV, or the HA styles won't work.
Why is that? Is there an automatic inheritance from Link
--> Visited --> Hover --> Active?


No.

Think about an ordinary link. It's unvisited so :link applies, but
when you move the mouse over it :hover also applies.
a:link {} and a:hover {} have equal specificity and so whichever is
specified last will take precedence. So the :hover style must come
after the :link style in order to work.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
Steve Pugh <st***@pugh.net> wrote:
Jamie <en***********@yahoo.com> wrote:
Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must be
added in LVHA order (link, visited, hover, active) or link styles will
stop working.


The order of LV isn't important, the order of HA is only of minor
importance;


I should calrify this last statement. The reason I said that the order
of HA is of minor importance is because :active is rarely important
itself. Further, many authors seem to set :active and :hover to the
same styles anyway. But if you do want to distinguish between when the
two then :active should come after :hover.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3

"Steve Pugh" <st***@pugh.net> wrote in message
news:c9********************************@4ax.com...
Jamie <en***********@yahoo.com> wrote:
Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must be
added in LVHA order (link, visited, hover, active) or link styles will
stop working.


The order of LV isn't important,
[...]


If you put :link after :visited, won't the properties defined in the :link
override the same properties defined in :visited, with the result that the
link's appearance won't change after its destination has been visited?

Jul 20 '05 #4
Harlan Messinger wrote:
If you put :link after :visited, won't the properties defined in the :link
override the same properties defined in :visited


No. :link is specifically defined as an *unvisited* link.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #5
"Harlan Messinger" <h.*********@comcast.net> wrote:
"Steve Pugh" <st***@pugh.net> wrote:

The order of LV isn't important,


If you put :link after :visited, won't the properties defined in the :link
override the same properties defined in :visited, with the result that the
link's appearance won't change after its destination has been visited?


No. :link and :visited are mutually exclusive. :link only applies to
unvisted links. See http://www.w3.org/TR/CSS2/selector.html#x27

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #6
On Tue, 03 Aug 2004 13:43:05 -0400, Jamie <en***********@yahoo.com>
wrote:
Meyer on p. 91 of "Eric Meyer on CSS" says that link styles must
be added in LVHA order (link, visited, hover, active) or link
styles will stop working.
Yea; it's been in the 'ciwas' authoring-FAQ for a while too.

<http://www.css.nu/faq/ciwas-aFAQ.html#QA09>
Why is that? Is there an automatic inheritance from
Link --> Visited --> Hover --> Active?


No, not really. It's just that the last applicable rule based on these
four in the style sheet will "win" since their level of specificity is
equal.

David Baron wrote an interesting page on the subject several years back,
still worth to study every now and then...

<http://dbaron.org/css/1999/09/links>

--
Rex
Jul 20 '05 #7
David Dorward <do*****@yahoo.com> wrote:
Harlan Messinger wrote:
If you put :link after :visited, won't the properties defined in the :link
override the same properties defined in :visited


No. :link is specifically defined as an *unvisited* link.


Didn't know that. (Not obvious!) Thanks.

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ôter le premier point de mon adresse de courriel.
Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Reply Via News Group Please | last post: by
7 posts views Thread by Jamie | last post: by
9 posts views Thread by tshad | last post: by
9 posts views Thread by Alan Silver | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.