In HTML, you can add margin-bottom and margin-top styles to the table element to set the line spacing. The syntax "
".
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:下外边间距值" >Copy after loginLet’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>Copy after loginOutput result:
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="max-width:90%" >Copy after loginLet’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>Copy after loginOutput result:
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!