HTML
Hypertext Markup Language
The Key to using a table in order to create a precise page grid is the use of the WIDTH attribute.
The WIDTH attribute for the <table> element specifies the width of the table in pixels or as percentage value, such as 80%.
The Height attributes can be used to the <table> tag as well as the <td> tag.
Attribute | Description |
---|---|
WIDTH | This WIDTH attribute for the <td> <th> elements. |
HEIGHT | This HEIGHT attribute for the <td> <th> elements. |
HTML Code
<html>
<head>
<title>table</title>
</head>
<body>
<table border="1" width="400" height="300">
<caption> Basic Fruit Comparison Chart </caption>
<tr>
<th width="200" align="center">Fruit</th> <th width="200" align="center">Color</th> </tr>
<tr>
<td align="center">Apple</td> <td align="center">Red</td> </tr>
<tr>
<td align="center">Avocado</td> <td align="center">Green</td> </tr>
<tr>
<td align="center">Watermelon</td> <td align="center"> Pink</td> </tr>
</table> </body>
</html>
<head>
<title>table</title>
</head>
<body>
<table border="1" width="400" height="300">
<caption> Basic Fruit Comparison Chart </caption>
<tr>
<th width="200" align="center">Fruit</th> <th width="200" align="center">Color</th> </tr>
<tr>
<td align="center">Apple</td> <td align="center">Red</td> </tr>
<tr>
<td align="center">Avocado</td> <td align="center">Green</td> </tr>
<tr>
<td align="center">Watermelon</td> <td align="center"> Pink</td> </tr>
</table> </body>
</html>
Output