HTML – Table

HTML Table

An HTML table is defined with the <table> tag.

Each table row is defined with the <tr> tag. A table header is defined with the <th> tag. By default, table headings are bold and centered. A table data/cell is defined with the <td> tag.

The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell.

A more complex HTML table may also include <caption>, <col>, <colgroup>, <thead>, <tfoot>, and <tbody> elements.

Attributes

AttributeValueDescription
alignleft
center
right
Not supported in HTML5.
Specifies the alignment of a table according to surrounding text
ValignTop Middle BottomControls the vertical alignment of cell contain it acceptor the value
bgcolorrgb(x,x,x)
#xxxxxx
colorname
Not supported in HTML5.
Specifies the background color for a table
border1
0
Not supported in HTML5.
Specifies whether or not the table is being used for layout purposes
cellpaddingpixelsNot supported in HTML5.
Specifies the space between the cell wall and the cell content
cellspacingpixelsNot supported in HTML5.
Specifies the space between cells
sizeNumeric valueSpecifies the Horizontal size of the textbox.
maxlengthNumeric valueSpecifies the Maximum Number of Character that user can enter.
ChekedNot supported in HTML5.
This attribute should be used only for check box and Radio Button from control. It indicates checked status.
widthpixels
%
Not supported in HTML5.
Specifies the width of a table
DISABLETurn off a from control
READONLYPrevent the form controls value from being chang.
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<b>
<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

</b>
</body>
</html>

Output :-

MonthSavings
January$100
February$80

Leave a Comment

Crypto logo

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus cursus rutrum est nec suscipit. Ut et ultrices nisi. Vivamus id nisl ligula. Nulla sed iaculis ipsum.

Contact

Company Name

Address