Using table tag

Using table tag

A table is created by using <table> tag. In the <table> element the table is built row by row. A row is present in a <tr> tag, which stands for ‘table row’. And each cell is then written inside the row element using a <td> tag, which stands for ‘table data’. Each cell must have a <td> or a <th> tag to display correctly. An example is shown

HTML code

<table border=”1″>

<tr>

<td>Row 1, Column 1</td>

<td>Row 1, Column 2</td>

</tr>

<tr>

<td>Row 2, Column 1</td>

<td>Row 2, Column 2</td>

</tr>

</table>

Browser output

 Using the table tag

The border is an attribute of <table> tag which is used to put border around all the cells but it is not used now and SS is used for the purpose. Other attributes of <table> tag are

Align – It takes value of Left, center, right. It is deprecated and CSS is used now. It specifies the alignment of a table according to surrounding text

Bgcolor – It specifies the background color for a table but is deprecated and CSS is used now. Its values are rgb(x,x,x ), #xxxxxx, and colorname

border-It specifies the width of the borders around a table. Its values are in Pixels

cellpadding – It specifies the space between the cell wall and the cell content Its values are in Pixels

cellspacing – It specifies the space between cells. Its values are in Pixels

frame – It specifies which parts of the outside borders that should be visible Its values are Void, above , below, hsides, lhs, rhs, vsides, box, border

rules – It specifies which parts of the inside borders that should be visible Its values are None, groups, rows, cols, all

summary – It specifies a summary of the content of a table Its values are Text

width – It specifies the width of a table Its values are in pixels.

Table Structure
tr Tag for Rows

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?