Horizontal Alignment
The CSS text-align property is used to set the horizontal alignment of the content in
This property can have one of the following values:
left- Aligns the text to the leftright- Aligns the text to the rightcenter- Centers the text
Note: By default, the content of
CSS text-align: center
To center-align the content of
text-align: center:
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
td
{
text-align: center;
}
CSS text-align: left
To force the content of
text-align: left on | Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
th
{
text-align: left;
}
Vertical Alignment
The CSS vertical-align property sets the vertical alignment (like top, bottom, or middle) of the content in
Note: By default, the vertical alignment of the content in a table is middle (for both
The following example sets the vertical text alignment to bottom for
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
td
{
height: 50px;
vertical-align: bottom;
}
Want to go beyond the notes?
Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.
Enroll Now — Free Demo AvailableTable Alignment – FAQs
Quick answers about learning Table Alignment in CSS.
This free note from CodingNow 2.0 explains Table Alignment in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Table Alignment, is 100% free with no signup required.
With focused practice, most students grasp Table Alignment in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.