0% found this document useful (0 votes)
21 views

Intro To HTML Tables

Tables are used to organize content into rows and columns using <table>, <tr>, and <td> tags. Tables have attributes like border, cellpadding, cellspacing, and bgcolor that control the table and cell borders, spacing, and background color. Cells can be grouped across rows using colspan or down columns using rowspan to merge multiple cells.

Uploaded by

drstragerlove
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Intro To HTML Tables

Tables are used to organize content into rows and columns using <table>, <tr>, and <td> tags. Tables have attributes like border, cellpadding, cellspacing, and bgcolor that control the table and cell borders, spacing, and background color. Cells can be grouped across rows using colspan or down columns using rowspan to merge multiple cells.

Uploaded by

drstragerlove
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

TABLES IN HTML

Tables
Tables are used to distribute HTML objects (text, graphics) in columns and rows. Example:
Visitors of the web site Month Page requests Sessions January 24.000 8.000

Table definition
To define a table you must:
Insert the table object: <TABLE Table_attributes> </TABLE> Specify the rows of the table: <TR> </TR> Specify the cells of each row and its contents: <TD Cell_attributes> Cell contents </TD>

Table definition
<TABLE BORDER=1> <TR> <TD>1</TD> First row <TD>2</TD> <TD>3</TD> </TR> </TABLE>

1 4 7

2 5 8

3 6 9

Table attributes
Border=n, where n is 0 or a positive number. When n is 0, no border is drawn. In any other case, the outer border of the table has a width of n. Cell borders are always thin. BorderColor=color, where color is a color name or number. It determines the color of the table and cell borders.

Table attributes
CellPadding=n, where n is 0 or a positive number. This is the amount of space between cell borders and the contents of cells. CellSpacing=n, where n is 0 or a positive number. This is the amount of space between cells of a table.

Table attributes
Align=s, where s is left, center or right. It determines the alignment of the table. BgColor=color, where color is a color name or number. When specified, the table background has this color.

Cell grouping
Consecutive cells in a row can be grouped. Consecutive cells in a column can be grouped. A rectangular block of cells can be grouped.

Grouping cells in a row


Attribute: ColSpan=n It groups n columns of a row Example: <td colspan=2>

Grouping cells in a column


Attribute: RowSpan=n It groups n rows of a column Example: <td rowspan=2>

You might also like