Use CSS styles to add a border to a table

Source: Internet
Author: User

Use CSS styles to add a border to a table

Table tables do not have a border before they are added to the CSS style. This does not facilitate our later merging of cell knowledge points, so in this section we add some styles to the table and add a border to it.

Add the following code to the right-hand code Editor:

<style type= "Text/css" >table tr td,th{border:1px solid #000;} </style>

The above code is in CSS style code (explained in detail later), for th the td cell to add a black border with a thickness of one pixel.

The result window shows the result style:

<! DOCTYPE html>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> add a border to a table </title>
<style type= "Text/css" >
Table TR td,th{border:1px solid #000;}
</style>

<body>
<table summary= "" >
<tr>
<th> class </th>
<th> Number of students </th>
<th> Average Results </th>
</tr>
<tr>
<td> class </td>
<td>30</td>
<td>89</td>
</tr>
<tr>
<td> Class II </td>
<td>35</td>
<td>85</td>
</tr>
<tr>
<td> Three Classes </td>
<td>32</td>
<td>80</td>
</tr>
</table>

</body>

Use CSS styles to add a border to a 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.