Settings for HTML table borders

Source: Internet
Author: User

For many beginners of HTML, table <table> is the most commonly used label, but for the control of the table border, many beginners are not very good solution.

Generally we use the table when always give it a border attribute, such as: <table border= "1", the effect is as follows:

Id NAME GENDER
1001 Mike Male

Can find the table border seems to be very wide, of course, the "very wide" here is definitely not the width of the table border, we see the width should be between the gap between <td>. Therefore, only need to modify the table CellSpacing property, namely: <table border= "1px" cellspacing= "0px", the effect is as follows:

Id NAME GENDER
1001 Mike Male

However, it seems that the width is still not as we imagined: only a single pixel width, in fact, you see is actually two pixels wide, for what, this is because the border between <td> is not caused by overlap. Modify the Border-collapse property of the table,

<table border= "1px" cellspacing= "0px" style= "Border-collapse:collapse" >

Id NAME GENDER
1001 Mike Male

Add a color to the table, <table border= "1px" bordercolor= "#000000" cellspacing= "0px" style= "Border-collapse:collapse" >

Id NAME GENDER
1001 Mike Male

Settings for HTML table borders

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.