I\'m working on an Asp.Net MVC 3 project and have run into a brick wall on why this doesn\'t work like I think it should.
My markup is:
fieldset > div:first-child
means "select the first child element of a fieldset
if it's a div
".
It does not mean "select the first div
in the fieldset
".
The first child in this case is <input type="hidden" value="2">
.
To select that div
without changing the HTML, you need to use fieldset > div:first-of-type
.
Unfortunately, while :first-child is widely supported, :first-of-type only works in IE9+ and other modern browsers.
So, in this case, the best fix is to continue using fieldset > div:first-child
, and simply move <input type="hidden" value="2">
so that's it's not the first child.