Home > Web Front-end > HTML Tutorial > Introduction to table-related knowledge in HTML (code examples)

Introduction to table-related knowledge in HTML (code examples)

不言
Release: 2018-10-12 17:27:25
forward
1976 people have browsed it

This article brings you an introduction to table-related knowledge in HTML (code examples). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

When making a web page, you must plan the layout of the web page reasonably. For example, adding a table to a web page can be divided into three parts: upper, middle, and lower parts. The upper part stores the web page title or LOGO image, the middle part is the main content of the entire web page, and the bottom part is the relevant production information. In addition, cells can be added to the cells to organize the content into categories and levels.

Table label --table

is a double label. A table contains three basic elements:

, ,
. The first tag and the last tag
indicate the beginning and end of a table. 'tr=table row' is used to indicate the start and end of a row, and 'td=table data' is used to indicate the start and end of a cell in the row.
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
                    ...
单元格内容单元格内容
单元格内容单元格内容

The title of the table--caption

There is a special cell called the title cell, located in the first row of the table, the title Cells have no borders and are centered by default.

<caption>表格的标题</caption>
Copy after login

Table border --border

By default, the table does not display borders. In order to better distinguish the content, you can set the width of the table border,

Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

The distance between the text in the table and the border--cellpadding

Default In this case, the text fits snugly into the border. The distance between the text and the border can be adjusted through cellpadding

Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

The distance between cells in the table--cellspacing

Cells in the table The distance between cells can also vary.

Copy after login
Copy after login
Copy after login
Copy after login
Copy after login

Cell background image--background

Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
nbsp;html>


    <meta>
    <title>小白</title>


<p>默认情况下的表格</p>
Copy after login
                                                                              
亚洲
中国北京1949年10月1日
缅甸内比都1948年1月4日

设置属性后的表格

                                                                              
亚洲
中国北京1949年10月1日
缅甸内比都1948年1月4日

Introduction to table-related knowledge in HTML (code examples)

##Row merge attribute-- rowspan

When making some complex tables, you need to use cell merging

<td>
<pre class="brush:php;toolbar:false">nbsp;html>


    <meta>
    <title>单元格行合并</title>


Copy after login
                                                                                     
招生简章
基础科目数学
外语
政治
专业课100

Introduction to table-related knowledge in HTML (code examples)

columns Merge attribute--colspan

When making some complex tables, you need to use cell merging

<td>
<pre class="brush:php;toolbar:false">nbsp;html>


    <meta>
    <title>单元格列合并</title>


Copy after login
                                                                                            
西安
长安区雁塔区碑林区
新城区高新区莲湖区

Introduction to table-related knowledge in HTML (code examples)

Nesting of tables

A table contains other tags inside. Using tables to layout the page can make the various parts of the page not conflict with each other and the overall structure is beautiful.

nbsp;html>


    <meta>
    <title>表格嵌套</title>


Copy after login
                                                                              
示例
昙花             Introduction to table-related knowledge in HTML (code examples)                      Introduction to table-related knowledge in HTML (code examples)         
浏览器             百度                                                                                                                                    
百度贴吧百度网盘百度图库
        

Introduction to table-related knowledge in HTML (code examples)

The above is the entire content of this article. For knowledge about HTML, you can refer to the

HTML Development Manual of the PHP Chinese website to learn.

The above is the detailed content of Introduction to table-related knowledge in HTML (code examples). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template