search
HomeWeb Front-endFront-end Q&AWhat are the properties of css setting table?

css sets the attributes of the table: 1. border-collapse attribute, collapse table border; 2. padding attribute; 3. border-spacing attribute; 4. caption-side attribute; 5. empty-cells attribute; 6 , table-layout attribute.

What are the properties of css setting table?

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

CSS table:

##caption-side##empty-cells

##Properties

Description

##border-collapse

Set whether to merge table borders into a single border.

border-spacing

Set the dividing cell border distance.

##Set the position of the table title .

Set whether to display in the table of empty cells.

##table-layout

##Set display unit, row and column algorithm.

1. Collapse table border: border-collapse attribute

(1) Function: Set whether the borders of the table are merged into a single border, or displayed separately like in standard HTML;
(2) Supplement Knowledge point: The table has a double line border. This is because the table, th and td elements have independent borders.

(3) Possible values:

##Value

default value. The borders will be separated. The border-spacing and empty-cells properties are not ignored. ##If possible, the borders will be merged into A single border. The border-spacing and empty-cells properties are ignored. inherit

Description

##separate

##collapse

## Specifies that the border should be inherited from the parent element The value of the -collapse attribute.

(4) Browser support: All major browsers support the border-collapse attribute.

Ps: Must specify !DOCTYPE, otherwise border-collapse may produce unexpected results.

2. Table inner margin: padding attribute

#Function: Control the content and content in the table For the distance of the border, please set the padding attribute for the td and th elements;

3. Border separation: border-spacing attribute

(1) Function: This attribute specifies the distance between cell boundaries in the separated border model. This property is ignored unless border-collapse is set to separate. Although this property only applies to tables, it is inherited by all elements in the table.

(2) Possible values:

## specifies that border should be inherited from the parent element The value of the -spacing attribute. (3) Browser compatibility: All mainstream browsers except IE support the border-spacing attribute. Internet Explorer 8 (and later) supports the border-spacing attribute if !DOCTYPE is specified.

##Value

describe

length length

Specifies the distance between the borders of adjacent cells. Use units such as px, cm, etc. Negative values ​​are not allowed.

If you define a length parameter, then the horizontal and vertical spacing is defined.

If two length parameters are defined, then the first sets the horizontal spacing, and the second sets the vertical spacing.

##inherit

4. Table title: caption-side attribute

(1) Function: Set the position of the table title, This property specifies the placement of the table title relative to the table frame. The table title is displayed as if it were a block-level element before (or after) the table.

(2) Possible values:

##ValueDescription##top ## specifies that the caption should be inherited from the parent element The value of the -side attribute.

(3) Browser compatibility: All mainstream browsers except IE support the caption-side attribute. Internet Explorer 8 (and later) supports the caption-side attribute if !DOCTYPE is specified.

5. Processing of empty cells: empty-cells attribute

(1) Function: This attribute definition How to represent table cells that contain no content. If displayed, the cell's borders and background are drawn. This property is ignored unless border-collapse is set to separate.

(2) Possible values:

default value. Position the table title above the table.

##bottom

## Position the table title within the table Down.

##inherit

##Draw a border around empty cells . default. inherit

##Value

Description

##hide

#Do not draw borders around empty cells.

show

## Specifies that empty should be inherited from the parent element The value of the -cells attribute.

(3) Browser compatibility: All browsers except IE support the empty-cells attribute. Internet Explorer 8 (and later) supports the empty-cells attribute if !DOCTYPE is specified.

6. Table layout algorithm: table-layout attribute

(1) Function: to display table cells , Algorithm rules for rows and columns. This attribute specifies the layout algorithm used to complete the table layout.

(2) Two algorithms:

Fixed table layout: fixed

          #Advantages: Allows the browser to layout the table faster, (in a fixed table layout, the horizontal layout only depends on the table width, column width, table border width, and cell spacing, and is not related to the table width, column width, table border width, and cell spacing. The content of the cell is irrelevant. By using a fixed table layout, the user agent can display the table after receiving the first row.);

       #Disadvantages: Not very flexible.

                                                                                                                                                                                    ,,,,,,,,,,,,,,, In automatic table layout, the width of the column is set by the widest content in the column cell without a row break.);

​​ #Disadvantages: The automatic algorithm is slower, this This is because it requires access to all the contents of the table before determining the final layout.

(3) Possible values:

##Value##The column width is determined by the table width and the column width Width setting. ##inherit)

Description

##automatic

default. Column width is set by cell content.

##fixed

## Specifies that table should be inherited from the parent element -The value of the layout attribute.

(Learning video sharing:

css video tutorial

The above is the detailed content of What are the properties of css setting table?. 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
利用CSS怎么创建渐变色边框?5种方法分享利用CSS怎么创建渐变色边框?5种方法分享Oct 13, 2021 am 10:19 AM

利用CSS怎么创建渐变色边框?下面本篇文章给大家分享CSS实现渐变色边框的5种方法,希望对大家有所帮助!

css ul标签怎么去掉圆点css ul标签怎么去掉圆点Apr 25, 2022 pm 05:55 PM

在css中,可用list-style-type属性来去掉ul的圆点标记,语法为“ul{list-style-type:none}”;list-style-type属性可设置列表项标记的类型,当值为“none”可不定义标记,也可去除已有标记。

css与xml的区别是什么css与xml的区别是什么Apr 24, 2022 am 11:21 AM

区别是:css是层叠样式表单,是将样式信息与网页内容分离的一种标记语言,主要用来设计网页的样式,还可以对网页各元素进行格式化;xml是可扩展标记语言,是一种数据存储语言,用于使用简单的标记描述数据,将文档分成许多部件并对这些部件加以标识。

css3怎么实现鼠标隐藏效果css3怎么实现鼠标隐藏效果Apr 27, 2022 pm 05:20 PM

在css中,可以利用cursor属性实现鼠标隐藏效果,该属性用于定义鼠标指针放在一个元素边界范围内时所用的光标形状,当属性值设置为none时,就可以实现鼠标隐藏效果,语法为“元素{cursor:none}”。

css怎么实现英文小写转为大写css怎么实现英文小写转为大写Apr 25, 2022 pm 06:35 PM

转换方法:1、给英文元素添加“text-transform: uppercase;”样式,可将所有的英文字母都变成大写;2、给英文元素添加“text-transform:capitalize;”样式,可将英文文本中每个单词的首字母变为大写。

rtl在css是什么意思rtl在css是什么意思Apr 24, 2022 am 11:07 AM

在css中,rtl是“right-to-left”的缩写,是从右往左的意思,指的是内联内容从右往左依次排布,是direction属性的一个属性值;该属性规定了文本的方向和书写方向,语法为“元素{direction:rtl}”。

css怎么设置i不是斜体css怎么设置i不是斜体Apr 20, 2022 am 10:36 AM

在css中,可以利用“font-style”属性设置i元素不是斜体样式,该属性用于指定文本的字体样式,当属性值设置为“normal”时,会显示元素的标准字体样式,语法为“i元素{font-style:normal}”。

怎么设置rotate在css3的旋转中心点怎么设置rotate在css3的旋转中心点Apr 24, 2022 am 10:50 AM

在css3中,可以用“transform-origin”属性设置rotate的旋转中心点,该属性可更改转换元素的位置,第一个参数设置x轴的旋转位置,第二个参数设置y轴旋转位置,语法为“transform-origin:x轴位置 y轴位置”。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor