"."/> ".">

Home  >  Article  >  Web Front-end  >  How to set table line spacing in html

How to set table line spacing in html

WBOY
WBOYOriginal
2021-11-11 17:11:0822269browse

In HTML, you can add margin-bottom and margin-top styles to the table element to set the line spacing. The syntax "

".

How to set table line spacing in html

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

#How to set the table line spacing in html:

1. You can maintain the distance between the table at the bottom and the table at the bottom by setting the margin-bottom attribute of the table. , the margin-bottom attribute sets the bottom margin of the element.

The code is as follows:

<table style="margin-bottom:下外边间距值" >

Let’s take a look at the example below:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>button</title>
</head>
<body>
<table style="border: 1px solid black;margin-bottom:100px" width="400" height="100" >
<tr>
<td style="border: 1px solid black" >1</td>
<td style="border: 1px solid black" >2</td>
<td style="border: 1px solid black" >3</td>
<td style="border: 1px solid black" >4</td>
</tr>
<table>
<table style="border: 1px solid black" width="400" height="100" >
<tr>
<td style="border: 1px solid black" >1</td>
<td style="border: 1px solid black" >2</td>
<td style="border: 1px solid black" >3</td>
<td style="border: 1px solid black" >4</td>
</tr>
<table>
</body>
</html>

Output result:

How to set table line spacing in html

2. You can maintain a distance from the table above by setting the margin-top of the table. The margin-top attribute sets the top margin of the element.

The code is as follows:

<table style="margin-top:上外边间距值" >

Let’s take a look at the example below:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>button</title>
</head>
<body>
<table style="border: 1px solid black;margin-bottom:100px" width="400" height="100" >
<tr>
<td style="border: 1px solid black" >1</td>
<td style="border: 1px solid black" >2</td>
<td style="border: 1px solid black" >3</td>
<td style="border: 1px solid black" >4</td>
</tr>
<table>
<table style="border: 1px solid black;margin-top:100px" width="400" height="100" >
<tr>
<td style="border: 1px solid black" >1</td>
<td style="border: 1px solid black" >2</td>
<td style="border: 1px solid black" >3</td>
<td style="border: 1px solid black" >4</td>
</tr>
<table>
</body>
</html>

Output result:

How to set table line spacing in html

For more programming-related knowledge, please visit: programming video! !

The above is the detailed content of How to set table line spacing in html. 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