Home >Web Front-end >CSS Tutorial >How to use CSS to set borders only for table labels

How to use CSS to set borders only for table labels

php中世界最好的语言
php中世界最好的语言Original
2017-11-20 17:25:322741browse

Many friends are very worried about how to set the table style. Today I will explain to you in detail how to set the css table style. Let’s talk about a method first, which is to set the border only for the table. Later, I will show you how to set other elements of the table. Please stay tuned

Only setting the border style for the table tag will give the outermost table of the table a border, but there will be no border inside the table. Generates a border style.

The case details are as follows:

1. Corresponding css code

c9ccee2e6ea535a969eb3f532ad9fe89 .table-a table{border:1px solid #F00} /* css Note: Only set the red border style for the table tag */ 531ac245ce3e4fe3d50054a55f265927

2. Corresponding html code snippet

1. Corresponding css code

<style> 
.table-a table{border:1px solid #F00} 
/* css注释:只对table标签设置红色边框样式 */ 
</style>

2. Corresponding html code snippet

<div class="table-a"> 
<table width="400" border="0" cellspacing="0" cellpadding="0"> 
<tr> 
<td width="105">站名</td> 
<td width="181">网址</td> 
<td width="112">说明</td> 
</tr> 
<tr> 
<td>PHP</td> 
<td>www.php.cn</td> 
<td>CSS学习</td> 
</tr> 
<tr> 
<td>CSS5</td> 
<td>www.php.cn</td> 
<td>CSS切图</td> 
</tr> 
</table> 
</div>

This is how CSS sets the border only for the label of the table. Have you learned it?

Related reading:

Using DIV and CSS to make a drop-down menu

css3 example of implementing shadow effect

Some points to pay attention to in css layout

The above is the detailed content of How to use CSS to set borders only for table labels. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn