CSS how to set table border style

Source: Internet
Author: User
Today, I want to talk to you about how CSS sets the table border style, and the CSS style border for table is divided into 4 cases, the following is a detailed explanation of how these four situations need to be handled.

1. Set the border only for table

2. Set the frame for TD

3. Set table border for table and TD skills

4. Set the background for table and TD to achieve perfect table border

Here are a few of the above to implement the HTML table border style to explain and case demonstration. For the sake of observation, divcss5 all the case table is 1px solid line red border For example, table width is 400px, table is three column three row, the above four case table extra layer add a div box, respectively css named ". Table-a", ". Table-b", ". Table-c ",". Table-d ".

Set borders only on table table labels


Setting the border (border) style only on the table label will give the table a border at the outermost table and no border style inside the table.

The case details are as follows:

1. Corresponding CSS code

<style>. Table-a table{border:1px Solid #F00}//CSS comment: Set the red border style only for table labels */</style>

2. Corresponding HTML code fragment

<div class= "Table-a" > <table width= "" "border=" 0 "cellspacing=" 0 "cellpadding=" 0 "> <tr> <td Width= "" > Station name </td> <td width= "181" > URL </td> <td width= "A" > Description </td> </tr> <tr> <td>PHP</td> <td>www.php.cn</td> <td>php</td> </tr> <tr> <td>php</td> <td>www.php.cn</td> <td>php</td> </tr> </table> </ Div>

CSS to set the table border style of the method is these, the need for friends can be saved, but also please continue to follow the site of other updates.

Related reading:

How to set the margin property of CSS


What are the different ways to set the background color of a div


Div+css How to use

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.