I'm toggling a class on an element when hovered, the class is added just fine but margin-top
seems to just get ignored. How do I get the margin-top
style to work correctly? My Code is Here @ jsfiddle. Code is just a snippet.
CSS:
#nav ul {
display: inline;
list-style: none;
}
#nav li {
float:left;
width:100px;
height:100px;
margin-top:0px;
margin-right:50px;
}
.hover {
background-color: red;
margin-top: 100px;
}
jQuery:
$('#nav ul a li').hover(function () {
$(this).toggleClass('hover');
});
HTML:
<div id="nav">
<ul> <a href="">
<li>
<h3>title</h3>
<p>description.</p>
</li>
</a>
<a href="">
<li>
<h3>title</h3>
<p>description.</p>
</li>
</a>
<a href="">
<li>
<h3>title</h3>
<p>description.</p>
</li>
</a>
</ul>
</div>