How can the browser display alternating colors for an HTML fieldset? I have form element开发者_Python百科s that are members of a fieldset, and each row must be an alternating color.
Something like this?
<style>
label:nth-child(even) {
background-color: #ddd;
display:block;
}
<style>
<fieldset>
<label> Input <input type="text"></label>
<label> Input <input type="text"></label>
<label> Input <input type="text"></label>
<label> Input <input type="text"></label>
</fieldset>
Here is how I did it...
I have a jquery function...
$("tr:odd").css("background-color", "#e8eef4");
That takes every odd row (I broke down and got table rows :-(... Unfortunately, the suedo-class for tr (tr:nth-child(odd)) doesn't work in IE 8 either... nested parenths ftw btw).
And that my friends is that.
精彩评论