search
HomeWeb Front-endHTML TutorialWhat is html table? How to use various attributes in the tag
tagAug 22, 2018 pm 01:59 PM
htmltable

html What is table? The various attributes and uses of the

tag are all in this article. It is very suitable for people who are new to the table tag to learn. This article clearly explains all the basic attributes of the table. The role of the html table table is also There are attributes and some usages here

First let us understand what a table is and its function

What is a table Table: It consists of some rectangular boxes called cells arranged together in order from left to right and top to bottom.

The function of table: to display information in a certain structure.

How we use table table:

Define table:

Create table row:

Create columns (cells):

Note: By default, columns in each row Numbers are unified.

table : display:table;

html table table features:

1. Exclusive row

2. Width adaptive (determined by content)

html table’s table attributes:

1, Attribute

1.width: Set the width of the table

2.height: Set the height of the table

3.align: Set the height of the table in its parent element Horizontal alignment, value: left, center, right

4.border: border, border width, value in px, px can be omitted

5.cellpadding

                                                                                                        off OUTCELL margins

             . The distance between cells or between cells and tables

7.bgcolor: background color

2. attribute in table

1.align: The horizontal alignment of the content of this line

2.valign The vertical alignment of the content of this line

Values: top, middle, bottom

3.bgcolor

3. attribute in table

width

    height
  • align
  • valign
  • bgcolor
  • colspan: Set cells to span columns
  • rowspan: Set cells to span rows
  • Also Other tags in the table:

1,

Function: Define the title for the table

Position: Centered display

<table>
    <caption>标题</caption>
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>

2, row title or column title

directly above the table Column title: Each column in the first row, bold, horizontally centered Effect display

Row title: The first column in each row, bold, horizontally centered effect display Row (column) title:

3. Complex application of tables

1. Row grouping

The table can be divided into 3 parts

1. Table header

2. Table body

3. Table foot
<table>
    <tbody>
         <tr></tr>
         <tr></tr>
    </tbody>
</table>

Note: If the table rows are not grouped, then by default they all belong to tbody

2. Irregular tables

Each The number of columns in a row is not uniform.

1. Cross-column Merge columns, let the specified cell move horizontally to the right, merge several cells (including itself)

Syntax: colspan attribute of td

2. Cross rows

Merge rows, let the specified cells go vertically downward, merge several cells (including yourself)

Syntax: rowspan attribute of td

Note: Whether it is across rows or columns, the merged cells must be deleted from the code

3. Nesting of tables

In A table has another table embedded in it

The nested table must appear in

<table>
    <tr>
       <td>
<table>
    <tr>
        <td>
        </td>
    </tr>
</table>
       </td>
    </tr>
</table>

html table table unique style attributes

1. Border merge of html table table style attributesAttribute: border-collapse

Value: 1.separate: Default value, separate border mode

1.collapse: Border merge mode

2. Border margin of html table table style attribute

1. Function: Set the distance between adjacent cell borders (similar to cellspacing)

2. Attribute: border-spacing

Value:

1. Take 1 value

which means the horizontal and vertical spacing are equal

2. Take 2 values ​​

First The horizontal spacing represented by the first value

The vertical spacing represented by the second value

Separated by a space between the two values

3.Requirements

border-collapse must be separate

It must be valid in the separated border mode

3. The title position of the html table table style attribute

Function: Change the title position from the default position to below the table

Attribute: caption-side

Value:

1. top: Default

2. Bottom: The title is below the table

4. Display rules for html table table style attributes

1.Function

Specify how the browser layouts a table. It actually specifies the algorithm rules of the cell

Default algorithm: The width of the cell is determined by the content and is not limited by the set width value.

2. Attribute: table-layout

Value:

1, auto: default value, automatic, column width is determined by the content

2 , fixed: fixed table layout, column width is determined by the set value.

3. Automatic table layout & fixed table layout

1. Automatic table layout (auto)

The size of the cell will adapt to the content size

In When the table is complex, loading will be slower

Suitable for use when the size of each column is uncertain

Traditional table presentation method

2. Fixed table layout (fixed)

The size of the cell is determined by the set value, regardless of the content.

It will speed up the display of the table, and the browser will not need to calculate it after loading the first row.

4. Hidden display effect

Attribute: visibility:collapse

Used on table elements to delete a row or column without affecting the entire layout of the table

Thank you for reading this article. If you have any questions or questions about this, you can ask below.

There is another article about this advanced version, welcome to click: Introduction to the style of the html5 table tag (with an example of html5 table css centering)

[small Related articles edited by editor]

html What is the function of em tag? The difference between and tags

html What does the optgroup tag mean? About the usage and attribute instance analysis of html optgroup tag

The above is the detailed content of What is html table? How to use various attributes in the

tag. 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
HTML超文本标记语言--超在那里?(文档分析)HTML超文本标记语言--超在那里?(文档分析)Aug 02, 2022 pm 06:04 PM

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

web前端笔试题库之HTML篇web前端笔试题库之HTML篇Apr 21, 2022 am 11:56 AM

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

总结HTML中a标签的使用方法及跳转方式总结HTML中a标签的使用方法及跳转方式Aug 05, 2022 am 09:18 AM

本文给大家总结介绍a标签使用方法和跳转方式,希望对大家有所帮助!

html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

html中document是什么html中document是什么Jun 17, 2022 pm 04:18 PM

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

html5支持boolean值属性吗html5支持boolean值属性吗Apr 22, 2022 pm 04:56 PM

html5支持boolean值属性;boolean值属性指是属性值为true或者false的属性,如input元素中的disabled属性,不使用该属性表示值为flase,不禁用元素,使用该属性可以不设置属性值表示值为true,禁用元素。

html焦点是什么意思html焦点是什么意思Jun 17, 2022 pm 04:05 PM

在html中,焦点是光标的意思,元素通过鼠标点击就可以获得光标,也即获得焦点;可以利用autofocus属性来规定当页面加载时元素会自动获得焦点,该属性是一个布尔属性,若指定元素设置该属性则会获得焦点,语法为“<指定元素 autofocus="autofocus">”。

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
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment