开发者

Alternating Row colors for an HTML Fieldset

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜