Table, Creating Tables in Web Page, Table Structure, Table Attributes, and TD and TH Attributes
Tables allow the author to arrange data elements such as text and images into columns and rows.
Uses of Tables:
There are complicated layouts that only table tags can solve. It help us to organize our data.
Use <table></table> to insert table. Tables are composed of rows, columns and cells.
Columns
Rows
Cells
<table><!--tag used to create table--> <tr> <th>Header</th> <td>Data</td> </tr> </table>
TABLE
ROW
HEADER
ROW DATA
<tr>
It is used to define the row of the table. One pair of <tr> is equivalent to one row.
<th>
It is used to define the header. Anything between these tags will be in bold format and aligned at the center.
<td>
It is used to define table data. Anything between these tags will be in regular data and aligned at left side. s
BORDER
This defines the thickness of the border. The value of border attribute is any number in pixels. <table border=5>
BORDER COLOR
This defines the color of the border. Value is in any color name or hexadecimal codes. <table bordercolor=red> <table bordercolor=DB0702>
CELLSPACING
It defines the spacing in between cells. It has a default spacing value of 2 pixels. <table cellspacing= 10>
CELLPADDING
Specifies the space between the cells content and its borders. <table cellpadding=5>
ALIGN
It is used to align the table to the right, center or left . By default, the table is aligned to the left. <table align=center>
BGCOLOR
It defines the color of the cell. Place this attribute to <tr> tag to apply the color to the entire row to minimize the use of bgcolor on either <th> or <td>. <th bgcolor=red>
VALIGN
It is used to align cells content vertically. The value of valign is the direction either top, middle or bottom. <th valign=middle>Headre</th>
COLSPAN
It is used to combine 2 or more columns. The value of colspan is the number of columns you wish to merge or combine. <th colspan=4>Header</th>
ROWSPAN
It is used to combine 2 or more rows. The value of rowspan is the number of rows you wish to merge or combine.
Type the given source codes to come up of the following output:
Prepare for a quiz tomorrow about the following topics:
Lesson 6.10 Lesson 6.11 HTML Lists HTML Tables
Study ... Study... Study... Super Happy Learning! Prepared by Mr. Marlon Lalaguna