PDA

View Full Version : class:focus



isaac_cm
20 Nov 2009, 05:12 PM
Hello,
I saw this CSS syntax for a class called "text"

.text:focus

what it is and what other parameters can take ?

Thanks

Wickham
21 Nov 2009, 05:49 AM
For anchors you have five states:-
a:link, a:visited, a:hover, a:active, a:focus { color: blue; }
In IE6 you can only have the states on the "a" tag but in modern browsers you can have them on any element, in the above case the class could be for a "a" tag or some other element.

The main feature of focus is to help people who use the tab key for tabbed browsing instead of a mouse, which means that they cannot highlight a link by hovering the mouse. Some disabled people cannot use a mouse, other people who use a laptop may not have a mouse and don't use the touch pad and others prefer to use tabbed browsing. See http://www.mahudsblog.ourgardenpath.com/?p=694 for some general advice. As you use the tab key it should highlight the links one by one according to your style setting so that the viewer always knows which link will activate when he uses the Enter key. IE doesn't support a:focus, using a:active instead.