Home > Article > Web Front-end > 【HTML】Table mark_html/css_WEB-ITnose
When designing web pages, tables are often used to organize page information. It can divide the web page into any number of rectangular areas. Each area can contain navigation, text, images, animations and other information. The designer can Place any web element into it.
1. Definition of table: f5d188ed2c074f8b944552db028f98a1f16b1740fad44fb09bfe928bcc527e08
1) Insert pairs of f5d188ed2c074f8b944552db028f98a1f16b1740fad44fb09bfe928bcc527e08 tags where tables need to be used, This will complete the insertion of the table. Commonly used tags for defining tables are
|
||||||||||||
f5d188ed2c074f8b944552db028f98a1
| Table tag, used to insert tables <html><head> <title>表格的定义</title></head><body> <table border="1"> <caption>计算机学习</caption> <tr> <th>CS</th> <th>数据库</th> <th>BS</th> </tr> <tr> <td>软件工程</td> <td>SQL Server</td> <td>html</td> </tr> <tr> <td>设计模式</td> <td>mySql</td> <td>JavaScript</td> </tr> </table></body></html> | |||||||||||
a34de1251f0d9fe1e645927f19a896e8 | Row tag, used to insert rows | |||||||||||
Column tag, used to insert columns | ||||||||||||
b4d429308760b6c2d20d6300079ed38e
|
Header tag, used to set header information | |||||||||||
63bd76834ec05ac1f4c0ebbeaafb0994 | Table title, set title
Tags > | |
ae20bdd317918ca68efdc799512a9b397943277d65306330563feb42dc8c705a | Define a set of header rows |
06669983c3badb677f993a8c29d18845d93f946a39a259de3097f230ac6e3edf | td>Add a label to the table |
92cee25da80fac49f6fb6eec5fd2c22aca745a59da05f784b8811374296574e1 | Define the main part of the table
2. Table attributes
In the design of web pages, it is often necessary to make some formatting settings for the table f5d188ed2c074f8b944552db028f98a1 in the web page. These settings are completed by setting the table tag attributes. of.
属性名称 | 说明 | ||||||||||||||||||
width | 表格的宽度 | ||||||||||||||||||
border | 边框粗细 | ||||||||||||||||||
frame(8种属性值) | 设置表格的边框样式
Attribute name | ||||||||||||||||||
Description
| width
| Width of the table
属性名称 | 说明 | ||||||||||
align(3种属性值) | 设置行内容的水平对齐方式
| ||||||||||
valign(4种属性值) | 设置行内容的垂直对齐方式
| ||||||||||
rowspan | 设置跨行,即单元格的纵向合并 | ||||||||||
colspan | 设置跨列,即单元格的横向合并 |
实例:
<html><head> <title>表格行与单元格的属性</title></head><body> <table width="500" frame="hsides" rules="all"> <caption>计算机学习</caption> <tr> <th>CS</th> <th>数据库</th> <th>BS</th> </tr> <tr> <td rowspan="2" align="center">设计模式</td> <td >mySql</td> <td>JavaScript</td> </tr> <tr> <td>SQL Server</td> <td>html</td> </tr> </table></body></html>
效果:
4.多个表格的使用
表格可以嵌套使用以表示层次关系,在f5d188ed2c074f8b944552db028f98a1标记插入表格后,可在b6c5a531a458a2e790c1fd6421739d1cb90dd5946f0946207856a8a37f441edf间再插入f5d188ed2c074f8b944552db028f98a1表示在单元格中插入表格;也可以多个同级表格同时使用,此时有两个常用的属性可方便表格的排版,美化布局。
cellspacing | 设置单元格的间距 |
cellpadding | 设置单元格中内容与边框之间的间距 |
小结:
表格是一种很简单的页面布局工具,它的应用使得网页简洁直观,且更便于阅读。熟练掌握主要的表格标记的相关属性,可以提高工作效率