Chapter 4 Table Elements-original learning points of water:
1. Table element Summary
2. construct table Parsing
Lecturer: Li Yanhui
This chapter describes how to use table elements in HTML5. A table is mainly used to display two-dimensional data in a grid.
I. Table element Summary
The basic structure of a table requires at least three elements:
,
,
, And some others exist as optional aids.
Element name |
Description |
Table |
Table |
Thead |
Indicates the title line. |
Tbody |
Table subject |
Tfoot |
Table foot |
Tr |
Indicates a row of cells. |
Th |
Indicates the header row cell. |
Td |
Cell |
Col |
Indicates a column |
Colgroup |
Indicates a group of columns. |
Caption |
Table title |
Ii. Build table Parsing 1.
Build basic tables
Zhang San |
Male |
Unmarried |
Li Si |
Female |
Married |
Explanation:
Element indicates the declaration of a table,
Element indicates a row in the table,
Element indicates a cell. By default, the table has no borders. Therefore 2. Add HeaderExplanation: 4. Add Table foot 5. Add Table subjectExplanation: 6. Explanation: Set ColumnsExplanation: 8. More flexible column settingExplanation: Explanation:
Add a border attribute to the element and set it to 1 to display the border.
Add a title cell to the table
Name |
Gender |
Marriage |
Zhang San |
Male |
Unmarried |
Li Si |
Female |
Married |
Explanation: |
The element is mainly used to add the cells of the title row. The actual function is to center and bold the internal text. A general attribute style is used here. It is mainly used for CSS style settings and will be involved in the future. |
|
All belong to cells and contain two merging attributes: colspan and rowspan. 3. |
Name |
Gender |
Marriage |
The element restricts and standardizes the table header. Especially when the header is dynamically generated in the future, its position is not fixed. You can use this element to limit it to the starting position.
Statistics: Two |
The element is used to generate table scripts, which are limited to the bottom of the table.
Zhang San |
Male |
Unmarried |
Li Si |
Female |
Married |
The element mainly contains the body part of a non-header table, which helps the table format to be clear and further facilitates CSS and JavaScript control.
Add Table title
This is a character table.
Element to add a title to the table.
7.
The element is used to process a column. The span attribute defines which columns to process. 1 indicates the first column, 2 indicates the first two columns. If you want to set the second column separately, you need to declare two. First, process the first column, move the column points to the second place, and then process the second one.
Each element represents a single column, and each element represents a column, making the control more flexible. If span is set, multiple columns are controlled.
|
|
|