TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)Tables in HTMLPage 3 of 6You are in page:» 3. Table width and height Table width and heightYou can specify the total width and height of your table using the width and height parameters inside our<table>tag. As in images, the default dimension unit is pixels, but you can also specify it as a percentage of its container using the % sign after the value number. Example: <table border="1" width="90" height="200"> <tr> <td>A</td> <td>B</td> </tr> <tr> <td>C</td> <td>D</td> </tr> </table> will produce something like:
and <table border="1" width="100%" height="80"> <tr> <td>A</td> <td>B</td> </tr> <tr> <td>C</td> <td>D</td> </tr> </table> will render:
Note: By default, when you are coding in XHTML you cannot specify a table height in terms of percentage unless you include the following code within the <head>section:
This is called a CSS style modifier. We will learn the principles of CSS styles in the next tutorial.
In the next page we will discuss how to control the height of a single row and the width of a single column.
|
|