HTML Table Text Align
From w3cyberlearnings
Contents |
HTML Table Align
We use the CSS to define the text align for the table cell.
Example 1 TRY-IT
In this example, we set the text align to left for all the cells in the table.
<style> table { padding:8px; border-spacing: 3px; } th,td { border:1px solid black; padding:13px; text-align:left; } </style>
Example 2 TRY-IT
This is similar to the first example, but we define the text align to right.
<style> table { padding:8px; border-spacing: 3px; } th,td { border:1px solid black; padding:13px; text-align:right; } </style>
Example 3 TRY-IT
This example, we set each individual cell.
<style> table { padding:8px; border-spacing: 3px; } th,td { padding:13px; border:1px solid black; } .righta { text-align:right; } .lefta { text-align:left; } .middlea { text-align: center; } </style>
Related Link
Table
- HTML - Table
- HTML - Table Border
- HTML - Table Column
- HTML - Table Row
- HTML - Table Color
- HTML - Table Cell Spacing and Padding
- HTML - Text Align
- HTML - Text Vertical Align
- HTML - Table Caption and Summary
- HTML - Table thead, tbody, tfoot
- HTML - Inner Table
- HTML - Table Vertical Line
- HTML - Table Horizontal Line