Ecom lab 2
Ecom lab 2
Aakansha
Priyanka Yadav
HTML Tables
HTML tables allow web developers to arrange data into rows and columns.
A table in HTML consists of table cells inside rows and columns.
Example: A simple HTML table
Table Cells
Each table cell is defined by a <td> and a </td> tag. And td
stands for table data. Everything between <td> and </td> is the
content of a table cell.
Table Rows
Each table row starts with a <tr> and ends with a </tr> tag. tr
stands for table row.
HTML Table Borders
HTML tables can have borders of different styles and shapes.
To add a border, use the CSS border property on table, th, and td
elements:
Collapsed Table Borders
To avoid having double borders like in the example above, set the
CSS border-collapse property to collapse.
This will make the borders collapse into a single border:
HTML Table Headers
HTML tables can have headers for each column or row, or for many
columns/rows.
Table headers are defined with th elements. Each th element
represents a table cell.
Vertical Table Headers- To use the first column as table headers,
define the first cell in each row as a <th> element.
Align Table Headers: By default, table headers are bold and
centered
Example
th {
text-align: left;
}
Example
For Vertical
Table Caption
You can add a caption that serves as a heading for the entire table.
Example
<table style="width:100%">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
To add a caption to a table, use the <caption> tag:
HTML Lists
HTML lists allow web developers to group a set of
related items in lists.
Unordered HTML List: An unordered list starts with
the <ul> tag. Each list item starts with the <li> tag.
The list items will be marked with bullets (small
black circles) by default.
Ordered HTML List : An ordered list starts with the
<ol> tag. Each list item starts with the <li> tag.
The list items will be marked with numbers by
default.
Example:
HTML Description Lists
Use the height and width attributes to specify the size of the iframe.
The height and width are specified in pixels by default:
Or you can add the style attribute and use the CSS height and width
properties:
<iframe src="demo_iframe.htm" style="height:200px;width:300px;"
title="Iframe Example"></iframe>
Iframe - Set Height and Width