I have this:
<div class="style1 neg">
<input type="submit" value="blah" />
</div>
And the css:
.style1 {
float: left;
margin-top: 25px;
}
.style1 .neg {
margin-top: 0;
}
I'm trying to negate margin-top, but when I inspect the element in the browser, the 'neg' style seems to be ignored completely. How would I do this properly?
The space, , is the descendant selector.
.style1 .neg
selects a .neg
that is a descendant of .style
. You want to use .style1.neg
Documentation: http://www.w3.org/TR/css3-selectors/#class-html
In action: http://jsfiddle.net/dH7JJ/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With