🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #62

Table Alignment


Horizontal Alignment

The CSS text-align property is used to set the horizontal alignment of the content in or .

This property can have one of the following values:

  • left - Aligns the text to the left
  • right - Aligns the text to the right
  • center - Centers the text

Note: By default, the content of elements are center-aligned and the content of elements are left-aligned!


CSS text-align: center

To center-align the content of elements, use 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 elements to be left-aligned, use text-align: left on elements:

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 or .

Note: By default, the vertical alignment of the content in a table is middle (for both and elements).

The following example sets the vertical text alignment to bottom for elements:

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 Available

Table 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.
WhatsApp
Call NowEnroll Now