Page 1 of 1

Linking a hover div

Posted: Thu Jun 17, 2010 5:00 pm
by Superphil
I was just wondering if this method is a best practice.

<a href=""> <div id="hoverDiv"></div> </a>

It works, and I don't have to use <img> tags. I don't know if it passes w3schools validation and I don't know of I would change even if it didn't. You guys have any thoughts?

Re: Linking a hover div

Posted: Mon Jun 21, 2010 5:44 am
by maneetpuri
Hello friend,

I don,t think that there would be any problem in this code from the W3C validation point of view....

Good Luck!

Re: Linking a hover div

Posted: Tue Jun 22, 2010 6:24 am
by kaszu
DIV is block element and A is inline element, blocks elements can't be children of inline elements.
Instead of DIV use SPAN (which is also inline element) together with CSS:

Code: Select all

#hoverDiv {
    display: inline-block;
    /* Rest of stuff ... */
}