Re: Should :active style only apply to links?

On 9 Aug 2009, at 10:15 PM, Brian Nixon wrote:

> Should the :active style only really apply to links (à la CSS1)?  It  
> looks odd when text that isn't a link changes appearance when you  
> click the mouse on it.
>
> I'm no CSS expert, but it looks like this was the behaviour with  
> CSS1, and with 2.1 you would need to change the 'a:active' selectors  
> in the site style sheets to 'a[href]:active' to achieve the same  
> effect.  But I'm guessing that not all UAs support that notation?
>

Hi Brian,

Here is a reply from Bert Bos. Hope it helps.

  _ Ian

> The CSS working group decided to leave it undefined whether all  
> elements
> can be ':active' or only certain ones. Clearly, elements that *do*
> something, such as hyperlinks, can be ':active', but in some document
> formats and in some software an element may become ':active' also when
> it has other actions attached or even when you can simply select it.
>
> Maybe with the experience gained in a few years we will be able to
> define more precisely what we mean by ':active', but for the moment
> designers will indeed have to take a careful approach and, as you
> suggested, use more precise selectors, which only match the elements
> that they *really* want to become ':active'.
>
> Personally, I think that designers should reserve the ':active' effect
> for cases where clicking (or otherwise activating) an element has an
> effect. If a click doesn't appear to do anything, then the element
> shouldn't change color during the click either. But I don't know on
> which page you noticed the behavior and it may be that the designer of
> that page has a different idea...
>
> There are no doubt still CSS implementations in use that do not
> support 'a[href]:active' but that doesn't have to be a barrier to its
> use. If the software doesn't know the selector, it will simply not
> change the style during the ':active' phase. I don't think that is a
> big problem.

--
Ian Jacobs (ij@w3.org)    http://www.w3.org/People/Jacobs/
Tel:                                      +1 718 260 9447

Received on Monday, 17 August 2009 06:21:22 UTC