Home  >  Article  >  Web Front-end  >  How to set the right border of the table in css

How to set the right border of the table in css

青灯夜游
青灯夜游Original
2021-11-10 17:59:024127browse

In CSS, you can use the border-right attribute to set the right border of the table. The function of this attribute is to specify the width, style and color of the right border of the element. The syntax "table{border-right: border width border" Style border color;}".

How to set the right border of the table in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In css, the border-right attribute can be used to set the right border of the table.

The border-right property is a shorthand property that sets all properties of the right border into one statement.

The properties that can be set are (in order): border-right-width, border-right-style, and border-right-color.

Example:

The default table is borderless:

<table>
	<tr>
		<th>姓名</th>
		<th>年龄</th>
	</tr>
	<tr>
		<td>Peter</td>
		<td>20</td>
	</tr>
	<tr>
		<td>Lois</td>
		<td>20</td>
	</tr>
</table>

How to set the right border of the table in css

You only need to set the border-right attribute to the table element , you can add a right border

table{
	border-right: 1px solid red;
}

How to set the right border of the table in css

(Learning video sharing: css video tutorial)

The above is the detailed content of How to set the right border of the table in css. 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