473,386 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 6767
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Reply Via News Group Please | last post by:
Folks, I'm new to CSS and realise that by posting in the html newsgroup, I might upset one or two readers by raising a CSS question in an html newsgroup however my ISP only has one small CSS...
4
by: Isabelle | last post by:
Hello all, I want two sets of links to do different things; one set within *content* and the other *navigational* elements. In particular I want the *hover* rollover effect to work differently...
7
by: Jamie | last post by:
Hi, This line is straight from page 82 of "Eric Meyer on CSS": td#main {background: #FFD; color: black; border: 2px solid #797; border-width: 2px 2px 2px 1px; } Isn't it redundant to have...
2
by: ChChanges | last post by:
Hi - I am going to buy a few books on CSS by Eric Meyer - I see that he is one of the leaders in CSS... Could somebody give me their opinion about the newer book 'More Eric Meyer on CSS' ? ...
19
by: Roger | last post by:
How can I pass parameters to a style sheet? I have noticed a couple of sites are now passing variables to the style sheet, which appear to be substituted at run time. For example: <link...
9
by: tshad | last post by:
I have been trying to use CSS in my ASP.NET pages and am trying to figure out the Stylesheet order and differences between Netscape (and Mozilla) and IE. I have the following in my .css file...
9
by: Alan Silver | last post by:
Hello, In an attempt to get my head around this CSS business, I have been reading Eric Meyer's two "on CSS" books. All seems clear and sensible, but I have a question which the good folks here...
3
by: Bob | last post by:
Hi, i'm testing the order of application when it comes to styling with skin and CSS files and i come to contradiction between what i get and what i read about theme and CSS. I wrote that...
2
by: Paulson | last post by:
HI all I got a problem with my menu display.I am making a list as shown below in one of my aspx pages. And added a stylesheet in CSS for it. This is not working in IE but not in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.