bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

CSS Table Styling

CSS Table Padding

To add some more space between the inner borders and the content in a table, use the padding property on

Formula

< td > and < th > elements:

First Name

Last Name

Savings

Peter

Griffin

$100

Lois

Griffin

$150

Joe

Swanson

$300

Example th, td

{
padding: 10px;
text-align: left;
}

CSS Horizontal Dividers

Formula

To create horizontal dividers for a table, add the border - bottom property to < th > and < td >

elements:

First Name

Last Name

Savings

Peter

Griffin

$100

Lois

Griffin

$150

Joe

Swanson

$300

Example th, td {
border-bottom: 1px solid #ddd;
}

CSS Hoverable Table

Use the CSS

Formula

:hover selector on < tr > to highlight table rows on mouse over:

First Name

Last Name

Previous

CSS Table Alignment

Next

CSS Responsive Tables