A comprehensive introduction to HTML table attributes
[Introduction] HTML tables are represented by
. These three Tags are the most commonly used Tags for creating tables. A table can be divided into many rows (rows), represented by | ||
.
These three Tags are the most commonly used Tags for creating tables.
<html> <body> <p> 表格所用到的Tag:整个表格开始要用table;每一行开始要用tr;每一单元格开始要用td。 </p> <h4>只有一行(Row)一列(Column)的表格</h4> <table border="1"> <tr> <td>100</td> </tr> </table> <h4>一行三列的表格</h4> <table border="1"> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> </table> <h4>两行三列的表格</h4> <table border="1"> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> </body> </html> Copy after login
border attribute By default, if the border of the table is not set, the table will not display the border.
<html> <body> <h4>缺省情况下,表格没有边界。</h4> <table> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> <h4>表格Border设为0,也不显示边界:</h4> <table border="0"> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> </body> </html> Copy after login
To display the border of the table, you can use the border attribute.
<html> <body> <h4>表格的边界值设为1:</h4> <table border="1"> <tr> <td>第一</td> <td>行</td> </tr> <tr> <td>第二</td> <td>行</td> </tr> </table> <h4>表格的边界值设为8,边界更粗:</h4> <table border="8"> <tr> <td>第一</td> <td>行</td> </tr> <tr> <td>第二</td> <td>行</td> </tr> </table> <h4>表格的边界值设为15,边界更粗:</h4> <table border="15"> <tr> <td>第一</td> <td>行</td> </tr> <tr> <td>第二</td> <td>行</td></tr> </table> </body> </html> Copy after login
Header of the table Use
<html> <body> <h4>有表头的表格:</h4> <table border="1"> <tr> <th>姓名</th> <th>电话</th> <th>传真</th> </tr> <tr> <td>Bill Gates</td> <td>555 77 854</td> <td>555 77 855</td> </tr> </table> <h4>竖直方向的表头:</h4> <table border="1"> <tr> <th>姓名</th> <td>Bill Gates</td> </tr> <tr> <th>电话</th> <td>555 77 854</td> </tr> <tr> <th>传真</th> <td>555 77 855</td> </tr> </table> </body> </html> Copy after login
Empty cells If there is no content between the cells of the table |
<html> <body> <table border="1"> <tr> <td>Some text</td> <td>Some text</td> </tr> <tr> <td></td> <td>Some text</td> </tr> </table> <p>上面的表格中,有一个单元格里是没有任何内容的,这个空的单元格没有显示边界,虽然整个表格设了边界值。</p> <table border="1"> <tr> <td>Some text</td> <td>Some text</td> </tr> <tr> <td> </td> <td>Some text</td> </tr> </table> <p> 上面的例子,你可以看到,给这个单元格加上一个空格符号之后,单元格的边界就显示出来了。</p> <p>注意:空格符要用&bsp;表示。 是一个HTML特别字符,参见HTML特别字符(HTML Character Entities)。 </p> </body> </html>
More examples
<html> <body> <h4> 这个表格有标题: </h4> <table border="6"> <caption>表格标题</caption> <tr> <td>100</td> <td>200</td> <td>300</td> </tr> <tr> <td>400</td> <td>500</td> <td>600</td> </tr> </table> </body> </html>
This example demonstrates how to use to add a title to a table.
<html> <body> <table border="1"> <tr> <td> <p>这是一段</p> <p>这是另外一段。</p> </td> <td>这个单元格里包含了一个表格: <table border="1"> <tr> <td>A</td> <td>B</td> </tr> <tr> <td>C</td> <td>D</td> </tr> </table> </td> </tr> <tr> <td>这个单元格里包含了一个图片: <img src = "../images/html_tutorials/mail.gif"> </td> <td>HELLO</td> </tr> </table> </body> </html>
The above is the detailed content of A comprehensive introduction to HTML table attributes. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
