HTML <table> Tags

Source: Internet
Author: User

Use of HTML table <table>

Tables are represented by table with each row in the table expressed in TD with each column in a TR row

For example, a table with three rows and two columns:

<table>

<tr>

<td> first Row first column </td>

<td> first row, second column </td>

</tr>

<tr>

<td> second row first column </td>

<td> second row, second column </td>

</tr>

<tr>

<td> The first column of the third row </td>

<td> third row, second column </td>

</tr>

</table>

Th means that the text in the header of the header is default to bold center th is to be placed in the TR to replace TD, for example:

<table>

<tr>

<th></th>

<th></th>

</tr>

<tr>

<td></td>

<td></td>

</tr>

</table>

Common Properties of Table

1.border Properties

Add a border to the table default to all TD border and to the entire table outside the box when you increase the value of border TD's border is unchanged only the outermost widening

<table border= "Ten" ></table>

2.cellspacing Properties

Represents the distance between a cell and a cell note that there is no distance between the cellspacing= "0" cell and the cell, but the width of the border line remains the width of the two line

Table border Merge CSS notation: style= "border-collapse:collapse;

What is the difference between this CSS and cellspacing?

cellspacing= "0" only adjusts the distance between cells to 0, but between cells is two lines

and style= "BORDER-COLLAPSE:COLLAPSE; is to merge the two borders adjacent to the table, with only one line present. Once the border merge CellSpacing property will be invalidated

3.cellpadding attribute cell border distance from the text in a cell

4.height: Height of table width: Table widths

<table height= "100px" width= "100px" ></table>

<table style= "height:100px;width:100px;" ></table> (CSS notation)

5.align Properties

Set the table overall in the browser location, has been eliminated, is not recommended to use.

Selectable values: Left center right

6.bgcolor background Color

Bgcolor= "Red"

7.bordercolor Border Color

Bordercolor= "Blue"

Background image will cover background color when 8.background background and background image are present

Background= "Img/computer.jpg"

<tr> and <td> Common properties

1.

Width: Cell width

Height: Cell Height

When you change a line or

2.bgcolor Property Cell background color

<table bgcolor= "Aqua" >

<tr bgcolor= "Blue" >

<TD bgcolor= "BLACK" ></td>

</tr>

</table>

The innermost covering of the outside

3. The Align property sets the text level in the cell to its way, the default station left

Selectable values: Left center right

The 4.valign property sets the text in the cell vertically to its way, in the default office

Selectable values: Top middle (center) bottom Upper and lower

5.nowrap attribute nowrap= "nowrap"

When there is too much text in the cell, the text of the set cell line is displayed continuously, but the width of the table is large.

Cross-row and cross-columns of tables

1. Cross-column: use attribute colspan= "n" on TD to cross-column. If a cell spans n columns, n-1 cells to the right of the cell are removed.

2. Cross-line: Use the attribute rowspan= "n" on the TD to cross the line. If a cell spans n rows, n-1 cells below the cell are removed.

HTML <table> Tags

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.