03-11-2014, 02:48 AM
width Attribute
Definition and Usage
The width attribute specifies the width of a table.
If the width attribute is not set, a table takes up the space it needs to display the table data.
Example
An HTML table with a width of 400 pixels:
Output
Syntax
Attribute Values
pixels Sets the width in pixels (example: width="50")
% Sets the width in percent of the surrounding element (example: width="50%")
Definition and Usage
The width attribute specifies the width of a table.
If the width attribute is not set, a table takes up the space it needs to display the table data.
Example
An HTML table with a width of 400 pixels:
PHP Code:
<table width="400">
<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>
Output
Month | Savings |
---|---|
January | $100 |
February | $80 |
Syntax
PHP Code:
<table width="pixels|%">
Attribute Values
pixels Sets the width in pixels (example: width="50")
% Sets the width in percent of the surrounding element (example: width="50%")