Sent by Roger Roelofs on 27 December 2004 22:10
George,
On Dec 27, 2004, at 10:33 AM, George Smyth wrote:
> I am wondering if it is possible to make a <div> a link and have it
> validate.
>
> I have the following code:
> <div class="OuterNavBox"><div class="InnerBox">
> <a href="http://Yahoo.com">nav1a</a></div></div>
>
> I have the standard "a:hover" which changes the font color and
> background when the mouse rolls over the link. I can do the same
> thing with the outer div (at least, in Firefox, it is not working with
> IE), but do not want to because only the anchor is the link. I can
> make the outer div the link by placing the anchor around the whole
> thing, but that does not validate.
>
> Is there a proper way to make the outer div the link? I can do this
> with JavaScript, but am wondering if there is a way to do this without
> using JavaScript (not everyone has it turned on).
If you set the a tag to have a style of display: block; it will fill
the inner div and make the whole thing clickable (aside from ie/win
quirks).
The only way to make the outer div hover and click like the link is to
use some javascript. You can see an implementation of this at
<http://www.mhvillage.com>. If you would like some help implementing
the javascript, let me know off-list.
hth
Roger,
Roger Roelofs
Know what you value.
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/