Detailed explanation of HTML table basics_html/css_WEB-ITnose
WBOY
Release: 2016-06-24 11:42:28
Original
1194 people have browsed it
In today’s era when div is so popular, the table tag seems to be rarely mentioned. There are books and blog articles about div css layout everywhere, but in fact table and other associated table tags are still there. It plays a very important role in web page layout. Especially when displaying data in the background, it is very important whether you are proficient in using tables. A refreshing and simple table layout can present complex data in an organized manner, although div layout can also do it. , but it is not always as convenient as a form. I often come into contact with tables. Now I will summarize some attributes and styles of tables, and learn to conceive some table styles for future needs.
1. Tags
defines the HTML table
tag defines the header of the table
Tag table body (text)
Tag defines the footer of the table (footnote or table note)
Element definition table header
Element definition table cell
Element definition table title, must be tight After the table tag. Only one title can be defined for each table, which is centered above the table by default. The
tag defines attribute values for one or more columns in the table.
The
tag is used to group columns in a table for formatting.
2. Table labels and label attributes
(1)
Label attributes To be honest, I personally think they are quite useful, such as align, width, etc. However, in line with the separation of the presentation layer and the structure layer, the use of them is now deprecated by w3c.
align: Equivalent to float, use CSS float instead of
bgcolor: Use CSS background-color instead of
border: The border attribute of table is inherited from The internal td tag is equivalent to setting the css border attribute for (selector): table and (selector) table td at the same time. However, when you set a border value greater than 1, only the border width of the table will change. The default browser properties include: border-collapse: separate; border-spacing: 2px; Therefore, after adding by default, it is a bilateral border
cellpadding: specifies the space between the edge of the unit and its content, which is actually the internal setting of the cousin. The padding attribute of td tag is replaced by (selector) table td setting the padding attribute of css.
cellspacing: Specify the space between cells, use (selector): table to set the padding attribute of css instead.
frame: Specifies which part of the outer border is visible, that is, setting the table border. This attribute is basically not used.
rules: Specify which part of the inner border is visible, same as frame, rarely used.
summary: Specifies a summary of the table content. Screen readers can use this attribute without other visual effects.
width: Use css width instead.
css properties
table-layout: automatic (default) | fixed | inherit (column width is set by cell content | column width is set by table width and column width settings | Inherit parent properties)
It should be noted that the width attributes of tables and column settings are displayed as min-width when table-layout is automatic. When the value of table-layout is When fixed, it behaves as a fixed width value.
When you need the width of the table content to be within the control range and not exceed the range you set, you can use the fixed attribute value to set this attribute. Here is an example.
---------------------------------- -----------------------------Give me a chestnut----------------- ------------------------------------------------
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