Table Border CSS

Source: Internet
Author: User

The table tag has no border by default, but if we add a border boder:1px solid black, and only the entire table has a border at the outermost side, how to style the table so that the whole table's TR and TD have a border:

1 <style>2 table, TH, TD{3 Border:1px solid Grey;4 Border-collapse:collapse;5 padding:5px;6}7 table Tr:nth-child (odd){8 Background-color:#f1f1f1;9}Ten table Tr:nth-child (even){ One Background-color:#ffffff; A} - </style>

The above code finally adds the css3:nth-child () selector to use a different background color for odd and even rows, and can also be used with the formula table tr: (2n+1).

Table Border CSS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.