Skip to main content
D
CSS
CSS Tables

CSS Tables

CSS formats the borders, alignment, and spacing of HTML tables.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

CSS transforms basic HTML tables into readable data grids. Developers use properties like borders, padding, and text alignment to space out the content. You can collapse the double borders into a single clean line.

Example

Example
1/* this styles tables */
2table {
3  border-collapse: collapse;
4  width: 100%;
5}
6
7th, td {
8  border: 1px solid black;
9  padding: 8px;
10}

Key Points

  • The `border-collapse` property merges double table borders.
  • Padding inside `` and `` adds breathing room.
  • Text aligns left by default in data cells.
  • The `nth-child` selector creates striped rows.

Up Next

Continue your journey with the next topic.

Go to CSS Display