Re: a:hover and a:active and named anchors

Jerry Baker wrote:
> 
> I realize that some people may want to apply :hover and :active to
> elements that don't "do" anything (but I can't figure out why). My
> concern is really only that named anchors are matching the a:hover and
> a:active selectors when they did not match in CSS1.

A couple of examples:

div.autoexpand p {display: none}
div.autoexpand:hover p {display: block}

<div class="autoexpand">
   <h2>Sub Heading</h2>
   <p>Text that goes with that subheading, that will only appear when 
the mouse is hovered over the heading. A similar technique could be used 
with table display types to get an expanding menu system that works even 
if the menu headings aren't links themselves. Using this trick with 
fixed, absolute or relative positioning could be used to produce a 
tooltip-like popup effect.</p>
</div>

img.thumbnail {width: 100; height: 100}
img.thumbnail:hover {width: auto; height: auto}

<img class="thumbnail" src="large-image.png" />

I agree that having a:hover and a:active match <a name=""> is a problem 
(and one that we wouldn't have if html had been designed sanely, with 
different elements for different purposes). That's why I suggested new 
pseudoclasses, so that legacy behavior could be preserved for :hover and 
:active, but effects like the above would still be possible.

Stuart.

-- 
Stuart Ballard, Programmer
NetReach - Internet Solutions
(215) 283-2300, ext. 126
http://www.netreach.com/

Received on Thursday, 25 July 2002 17:11:09 UTC