I’ve following HTML, the div .info has display:none by default, I want to change that to display:block on hover. I’m trying following CSS but the :hover does not work.
HTML:
<div id="items">
<div class="item">
<a href="#">
<div clas="info">
</div>
</a>
</div>
</div>
CSS
#items .item a .info{
display: none;
}
#items .item a .info:hover{
display: block;
}
JSFiddle:
http://jsfiddle.net/qcDtF/
Thanks.
You cannot hover over something that is not displayed. You could use opacity or visibility instead. jsFiddle.
Alternatively, if you really want to use
display:none, then give#items,.item, or your outeraa set width and height, and place the:hoveron that element. jsFiddle. For example:If you want the correct
widthandheight, you can use javascript/jQuery to get the width/height of a visible.info, hide.info, and then set the height/width of#itemsto those values gotten from.info.