navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Link order is IMPORTANT

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> Link order is IMPORTANT
Page: [1]
 
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
Link order is IMPORTANT - 3/26/2004 2:05:51   
For the record and because it comes up so very very often:


  • An anchor has five states, not four.
  • The order is important if you get it wrong you're likely to come to grief: -

    1. link
    2. visited
    3. hover
    4. focus
    5. active







You can very easily specify different styles for each state simply by doing something similar to the very simple example below adding or deleting the various possibilities as pleases you:

a:link {
background: red;
}
a:visited {
background: blue;
}
a:hover {
background: green;
}
a:focus {
background: yellow;
}
a:active {
background: pink;
}

Or whatever ......

Most people forget about or don't know about focus. It is used for by those who navigate using a keyboard or specially adapted devices for handicapped and many many moblile telephones. Googlebot takes notice of it too.

Further notes:

If you go and read the spec. (Yes I know I always say that I always say that because if you don't read the spec, and/or you don't validate how do you think you'll track down problems?)

http://www.w3.org/TR/REC-CSS2/selector.html

You'll see that it says:

quote:

5.11.3 The dynamic pseudo-classes: :hover, :active, and :focus
Interactive user agents sometimes change the rendering in response to user actions. CSS provides three pseudo-classes for common cases:

The :hover pseudo-class applies while the user designates an element (with some pointing device), but does not activate it. For example, a visual user agent could apply this pseudo-class when the cursor (mouse pointer) hovers over a box generated by the element. User agents not supporting interactive media do not have to support this pseudo-class. Some conforming user agents supporting interactive media may not be able to support this pseudo-class (e.g., a pen device).

The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it.

The :focus pseudo-class applies while an element has the focus (accepts keyboard events or other forms of text input).
These pseudo-classes are not mutually exclusive. An element may match several of them at the same time.

CSS doesn't define which elements may be in the above states, or how the states are entered and left. Scripting may change whether elements react to user events or not, and different devices and UAs may have different ways of pointing to, or activating elements.

User agents are not required to reflow a currently displayed document due to pseudo-class transitions. For instance, a style sheet may specify that the 'font-size' of an :active link should be larger than that of an inactive link, but since this may cause letters to change position when the reader selects the link, a UA may ignore the corresponding style rule.




Clearly therefore the following statements are true:


  1. The active state is brief.
  2. The active state is not always obvious.
  3. Browsers do not have to acknowledge its existence. Although in fact most of them do.
  4. Anybody who doesn't test their pages in a real live browser or better yet in several real live browsers and relies on "preview mode" is asking for trouble, and to be quite frank IMO deserves it too. Using ALT+TAB and hitting the refresh key isn't exactly difficult.



Most problems arise because people either don't get the order right (see above) or in the case of more technically minded people because they have made unwarranted assumptions.

All five states - link, visited, hover, focus, active, have the same specificity - which for some reason or another (said the Gorilla getting sniffy) isn't how developers seem to think about links.

So lets make it really clear all five states are equally important, UAs therefore apply each rule in turn. Therefore a:link will override a:visited if you get it wrong and it appears later in the style rules.

This makes perfect sense, is good logic and therefore good mathematics too. The alternative would be to let browser manufacturers treat arbitrary selectors as more important than others which would confuse the not only the recommendation, but everyone else as well.

As it appears (said the Gorilla getting even sniffier having spent several hours last night with an unbelievably uncomprehending "practising" professional) that <ahem>some</ahem> browser manufacturers aren't competent enough to keep up as it is, and can't even wrap their heads around the meaning of a simple figure like 100% this would be a recipe for disaster.

Get the order right, read the spec, validate, validate, validate.

< Message edited by gorilla -- 3/26/2004 2:45:07 >


_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower


c1sissy

 

Posts: 5079
Joined: 7/20/2002
From: NJ
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 7:39:47   
Thanks for this Mhaircaish.

I never knew that there was a focus as well.

_____________________________

Deb-aka-c4Ksissy
high panjandurum and alpha female of the silverback tribe
As decreed by Jesper 5-24-2003.
The only stupid question is... the one that is never asked!!
http://directory.css-styling.com
http://fmsforum.com
http://positioniseverything.net/
http://www.tanfa.co.uk/

(in reply to gorilla)
lilblackgirl

 

Posts: 288
Joined: 5/16/2002
From:
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 9:42:47   
I'm ashamed to say it, but not until Deb and I were chatting last night about my latest problem (one in the multitude) and me doing some research, did i even know that the focus state existed. Even worse, I had been getting my ordering wrong and ended up going back to all of the work i've done in the past to check and see how badly out of order it all was. Thanks for the clairification Gorilla, I'm REALLY glad we have you here.

//Lil hands Gorilla a bunch of bananas :)

Lil

_____________________________

You look like you're about to do something stupid. I'm in.

(in reply to c1sissy)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 10:46:30   
Gorilla grabs Lil and the bananas and sets off for a quite secluded grove in the forest for a picnic.:)

_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to lilblackgirl)
Giomanach

 

Posts: 6075
Joined: 11/19/2003
From: England
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:03:15   
quote:

Gorilla grabs Lil and the bananas and sets off for a quite secluded grove in the forest for a picnic
No Comment:):)

_____________________________




(in reply to gorilla)
lilblackgirl

 

Posts: 288
Joined: 5/16/2002
From:
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:09:41   
Yeah, i didn't know i had a date . . . :)

Heya Gorilla, since I'm just a good old boy (yes, i'm not really a girl - don't ask) from Texas, I'm not up on languages other than Texican. You mind me asking what your sig means?
quote:

Kongens Lyngby,
Københavns Amt,
Danmark - Søndag 21. marts 2004


Lil

_____________________________

You look like you're about to do something stupid. I'm in.

(in reply to Giomanach)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:24:20   
quote:

ORIGINAL: lilblackgirl

Yeah, i didn't know i had a date . . . :)

Heya Gorilla, since I'm just a good old boy (yes, i'm not really a girl - don't ask) from Texas, I'm not up on languages other than Texican. You mind me asking what your sig means?
quote:

Kongens Lyngby,
Københavns Amt,
Danmark - Søndag 21. marts 2004


Lil


Oh thats ok LIL I won't ask.

It is Danish.

Kongens Lyngby = Name of the town = (in English) "Royal Lyngby" or "The Kings Town of Lyngby" if you want to get very accurate about it.
Københavns Amt = Name of the region = (in English) The state county of Copenhagen.
Danmark = Name of the Country = (in English) Denmark.

the rest of it is the date I put that up. Sunday March 21st 2004. Also of course in Danish.

< Message edited by gorilla -- 3/26/2004 11:26:35 >


_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to lilblackgirl)
lilblackgirl

 

Posts: 288
Joined: 5/16/2002
From:
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:30:58   
thanks buddy.
see, we can learn more here than just coding.

_____________________________

You look like you're about to do something stupid. I'm in.

(in reply to gorilla)
Peppergal

 

Posts: 2204
Joined: 9/20/2002
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:35:32   
quote:

The :focus pseudo-class applies while an element has the focus (accepts keyboard events or other forms of text input).
These pseudo-classes are not mutually exclusive. An element may match several of them at the same time.


Does this mean it will allow users to navigate to the next link using the keyboard? Like setting up a tab order on a form?

_____________________________

Northeast PA / Poconos/ Lake Wallenpaupack Real Estate
wallenpaupacklakeproperty.com
Karen's Real Estate Blog

(in reply to gorilla)
lilblackgirl

 

Posts: 288
Joined: 5/16/2002
From:
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 11:41:29   
quote:

Does this mean it will allow users to navigate to the next link using the keyboard? Like setting up a tab order on a form?


That's how i would take it. In the example used on a cell phone, you'll see that tabbing to links is the only way to navigate a site, so this makes sense, but was there someone out there viewing thru a browser minus a mouse saying "You know, there's got to be a way to navigate this site. Maybe i'll just creat a link state and incorporate it into the newest CSS code." :)

_____________________________

You look like you're about to do something stupid. I'm in.

(in reply to Peppergal)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: Link order is IMPORTANT - 3/26/2004 12:33:51   
Word of warning first: Accesskeys can be a little tricky to implement.

There's a good article here:

http://www.alistapart.com/articles/accesskeys/

Sometimes they're very tricky indeed to implement and many feel they're not worth the bother:

http://www.mezzoblue.com/archives/2003/12/29/i_do_not_use/index.php

(Incidentally the Jesper who posted there isn't the "gorilla" Jesper.)

I don't agree with what is said on mezzoblue btw although they are very often badly supported and it is true that you need to think long and hard before going down that route. Very important for any government work or can be. Support is getting better though. Opera IMO is deficient in this regard IE does it pretty well. So does Mozilla.

That said:

http://www.w3.org/TR/REC-html40/interact/forms.html - scroll down to 17.11.2

Mark Pilgrim's work here is invaluable

http://diveintoaccessibility.org/

- day 15 especially -

http://diveintoaccessibility.org/day_15_defining_keyboard_shortcuts.html

download it. And work through it after you feel you're up to speed on basic css and at least know the terminology for the rest. If you put in brainsweat on this it does repay. Big time it repays and as s508 in the USa starts to bite can be very lucrative as well.

We're going a bit OT here so I'll leave it at that.

_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to lilblackgirl)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> Link order is IMPORTANT
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts