Implementation of the HTML Thin Line table

Source: Internet
Author: User

In web authoring, we often use tables to make the information we need to express clearer and clearer.

<TableBorder= "1"cellspacing= "0"bordercolor= "#000000"width= "80%">    <TR>        <th>Name</th>        <th>Age</th>    </TR>    <TR>        <TD>111</TD>        <TD>22</TD>    </TR>     <TR>        <TD>222</TD>        <TD>21st</TD>    </TR></Table>

This code defines a table with border = 1pix, but actually the actual border width of the table is 2pix, because the table border consists of two parts: the outer box of the table and the border of the cell.
So how do you define a thin-line table (the actual siding is 1pix)?

1. Using cellspacing and background color technology:

<Tableborder= "0"cellspacing= "1" bgcolor= "#000000"width = "80%">     <tr bgcolor= "#ffffff">        <th>Name</th>        <th>Age</th>    </TR>    <tr bgcolor= "#ffffff" >        <TD>111</TD>        <TD>22</TD>    </TR>     <tr bgcolor= "#ffffff" >        <TD>222</TD>        <TD>21st</TD>    </TR></Table>

2. Use the Border-collapse property:

<Tableborder= "1" cellspacing= "0" bordercolor= "#000000" width = "80%" Style= "border-collapse:collapse;">       <TR>        <th>Name</th>        <th>Age</th>    </TR>    <TR>        <TD>111</TD>        <TD>22</TD>    </TR>     <TR>        <TD>222</TD>        <TD>21st</TD>    </TR></Table>

Reminder: For thin-line tables made from Method 1, there may be problems with the table border not being printed when printing. and Method 2 does not have this problem, recommended to use.

Implementation of the HTML Thin Line table

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.