HTML table

HTML tables

Tables are defined by the tag. Each table has a number of rows (defined by tags), and each row is divided into a number of cells (defined by
tags). The letters td refer to table data, the contents of data cells. Data cells can contain text, pictures, lists, paragraphs, forms, horizontal lines, tables, and more.

Here is an example:

   Table in html 

水平表头

Name Age Gender
zdd 30 male

垂直表头

Name autumn
Age 30
Gender famale

Try it

Borderless table

If the border attribute is not specified when defining the table, then the table will have no border

##
#
zdd< ;/td>30



Empty cellIf there is no cell Specify the content, then the cell will be empty and have no borders


What if it is solved? The method is to add spaces to empty cells. Since HTML ignores extra spaces, we cannot add spaces directly, but add nbsp to indicate non-breaking space.


##

#Table with title


Use the caption attribute, but it seems that there cannot be spaces in the title, otherwise it will wrap when displayed! Isn't that too ridiculous?


##

zdd30

My table
;zdd30
20


Crossing rows or columns



##Use colspan to cross rows

NamePhone number
Bill Gates555 77 854555 77 855

Use rowspan to span columns





Name Bill Gates
Phone555 77 854
555 77 855

##HTML table header

The header of the table is defined using the
tag.

Most browsers will display the table header as bold, centered text:












Header 1Header 2
row 1, cell 1row 1, cell 2
row 2, cell 1
row 2, cell 2

##

Continuing Learning
||
php.cn

背景颜色:

First Row
Second Tom
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!