473,394 Members | 1,828 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,394 software developers and data experts.

:focus and :active pseudo-classes

The issue of the focus pseudo-class came up a few weeks ago, and I
finally got around to trying it out (better late than never ...)

The recommended order given for the pseudo-classes is link, visited,
focus, hover, active. However:

- Mozilla doesn't seem to do anything with the active rule;
- IE gets things wrong as usual: it uses the active rule for focus; it
ignores the focus rule;
- Opera ignores both focus and active rules and substitutes its own
highlighting. (Perhaps a good decision as it results in consistency
across sites and makes it easier to see where one is.)

I'm not convinced that the active pseudo-class does anything useful
anyway; or if it does why it should need a different colour from focus.
I would suggest therefore that the pragmatic order for specifying the
pseudo-classes would be:

A:link
A:visited
A:active, A:focus /* in other words: IE focus, Gecko focus */
A:hover

Or, if you still have some <A NAME=...> tags lying around for the
benefit of NN4:

A:link
A:visited
A:active, A:focus
A:link:hover, A:visited:hover

Comments?

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 21 '05 #1
4 4483
Stephen Poley wrote:
- Mozilla doesn't seem to do anything with the active rule;
I've seen Mozilla respond to :active as expected (i.e. it applies the style
when the mouse button is being depressed over the element)
I'm not convinced that the active pseudo-class does anything useful
anyway;
Pretty much any (GUI interface) button you see will change state (chaning
from raised to depressed) when the mouse is clicked over it.
A:active, A:focus /* in other words: IE focus, Gecko focus */
A:hover


Then :active will never fire for browsers which implement it correctly.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 21 '05 #2
Stephen Poley wrote:
The issue of the focus pseudo-class came up a few weeks ago, and I
finally got around to trying it out (better late than never ...)

The recommended order given for the pseudo-classes is link, visited,
focus, hover, active. However:

- Mozilla doesn't seem to do anything with the active rule;
Odd. For quite some time, I've been using a:hover and a:focus in one
rule, and a:active in a following rule, e.g.,

a:hover, a:focus { color: 600; background: #9c9;}
a:active { color: blue; background: #999;}

And I've had glitch-free results in Mozilla. Example page:

http://www.tsmchughs.com/

Works as expected in Firefox 1PR.
- IE gets things wrong as usual: it uses the active rule for focus;
it ignores the focus rule;
MSIE 6/Win does indeed screw up :focus, applying :active rules instead.
Since it isn't mission critical, and MSIE is an old browser, I'm not
worrying about it. But it is the first time that I noticed that bug.
- Opera ignores both focus and active rules and substitutes its own
highlighting. (Perhaps a good decision as it results in consistency
across sites and makes it easier to see where one is.)


I'm pretty sure :focus and :active worked fine in Opera 7.x when I
tested, but I don't have Opera on the maching I'm using, so I cannot
confirm that.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #3
On Mon, 15 Nov 2004 18:41:17 +0000, David Dorward <do*****@yahoo.com>
wrote:
Stephen Poley wrote:
- Mozilla doesn't seem to do anything with the active rule;


I've seen Mozilla respond to :active as expected (i.e. it applies the style
when the mouse button is being depressed over the element)


Well, you live and learn. I thought the idea of 'active' was to display
briefly on clicking. Now I see it displays when you *hold* the mouse
button down. This makes it seem even less useful than I thought - why
would anyone hold the mouse-button down when clicking a link? Does that
do anything useful in any browser?
I'm not convinced that the active pseudo-class does anything useful
anyway;


Pretty much any (GUI interface) button you see will change state (chaning
from raised to depressed) when the mouse is clicked over it.


And for a typical GUI button-bar which remains on view while another
part of the display is changed, that could be useful. But when the
purpose is to replace the page entirely by a different page, I don't see
what the benefit is.
A:active, A:focus /* in other words: IE focus, Gecko focus */
A:hover


Then :active will never fire for browsers which implement it correctly.


I know. My question is - does that matter?

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 21 '05 #4
in comp.infosystems.www.authoring.stylesheets, Brian wrote:
I'm pretty sure :focus and :active worked fine in Opera 7.x when I
tested, but I don't have Opera on the maching I'm using, so I cannot
confirm that.


:focus works in Opera, but it has it's own selection thing for most
elements (not form elements for example) that overrides :focus
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrew Thompson | last post by:
I would like to create a menu that uses the 'active' pseudo-class to highlight the current page, but I cannot get it to work. The URL http://www.lensescapes.com/tst/nav/1.jsp shows the attempts...
0
by: Vinod. | last post by:
Hi all, I have added browser control to a windows form. I am loading pages having multiple frames. I have noticed that the focus in a text is not maintained when the application is deactivated....
1
by: Workgroups | last post by:
Not having much luck tracking this down... I'm working with a form, Form1, which contains a panel called pnlParent. Both Form1 and pnlParent have AutoScroll = False. pnlParent contains a panel...
9
by: newcomsas | last post by:
Hello. I'm working on a problem related with CSS and javascript: I have got a link on a page and a stylesheet file that makes the background color change when users click on it. Is there...
1
by: Werner Schmidt | last post by:
Dear group, I have a very strange behaviour: In a loop there are several TextBoxes initialized: TextBox objTextBox = null; // one declaration for-loop // multiple initialisations
5
by: NeBlackCat (lists) | last post by:
Hello everybody - my first post! And it may be the most monumentally stupid question ever asked, but I just can't see an answer after several hours experimenting, searching and reading. It's...
5
by: flashsilverlight | last post by:
i have a c# application in which it has several forms. how do i make it so that a certain form would not lose focus while it is active? i mean, the only possible way to get to another form is by...
4
by: =?ISO-8859-15?Q?Albe_V=B0?= | last post by:
In my Application, I need to make a certain graphical refresh, interrogating SqlServer, only if Application has focus (i.e. the title bar is blue). Interrogating .Focused property of various...
10
by: Gary | last post by:
I'm trying to find a way to determin which window Within-Another-Program currently has the focus. THE SITUATION: (Skip down to "My Question" if you don't want the background...) * This is...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.