Linking a hover div

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
Superphil
Forum Newbie
Posts: 3
Joined: Tue Jun 08, 2010 11:59 am

Linking a hover div

Post 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?
maneetpuri
Forum Commoner
Posts: 60
Joined: Tue Oct 07, 2008 6:32 am

Re: Linking a hover div

Post 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!
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Linking a hover div

Post 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 ... */
}
Post Reply