The vertical-align property sets the vertical alignment, like top, bottom, or middle. By default, the vertical alignment of text in a table is middle (for both <th> and <td> elements). The following example sets the vertical text alignment to bottom for all of the <td> elements that have a height of 50 pixels:
HTML file: | Displayed by browser: | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<style>
table, td, th { border: 1px solid black; } td { height: 50px; vertical-align: bottom; } </style> <body> <table> <tr> <th>First Name</th> <th>Last Name</th> <th>Savings</th> </tr> <tr> <td>Peter</td> <td>Griffin</td> <td>$100</td> </tr> <tr> <td>Lois</td> <td>Griffin</td> <td>$150</td> </tr> <tr> <td>Joe</td> <td>Swanson</td> <td>$300</td> </tr> <tr> <td>Cleveland</td> <td>Brown</td> <td>$250</td> </tr> </table> </body> |
|