HTML Table Sizes

HTML Tutorial

HTML Forms

HTML Graphics

HTML Media

HTML API

HTML Table Sizes

HTML Table Width

Adding the style attribute to the

element, allows to set the width of a table:

Example

				
					
table, th, td {
  border:1px solid black;
  border-collapse: collapse;
}
<h2>100% wide HTML Table</h2>
<table style="width:100%">
  <tr>
    <th style="width:70%">Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    <td>80</td>
  </tr>
</table>


				
			

Output:

100% wide HTML Table

Firstname Lastname Age
Jill Smith 50
Eve Jackson 94
John Doe 80

HTML Table column width

To set the size of a specific column, add the style attribute on a <th> or <td> element:

Example

				
					  <table style="width:100%">
  <tr>
    <th style="width:70%">Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  </table>

				
			

Output:

Firstname Lastname Age

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/u212091429/domains/mydevhelp.com/public_html/wp-includes/functions.php on line 5420