Styling Tables with CSS Made Easy

This CSS tutorial covers the basics of styling a table, including dealing with the border-collapse: property and properly aligning your elements.

This video does a really good job of moving through the essential steps necessary, starting with looking at the borders and margins and making sure to use CSS shorthand where possible to keep things clean and tidy.

Join us in our newest publication:

Now while the border-collapse: and margin properties deal with the table {} declaration as a whole, padding adjustments are in relation to the individual table cells under the td, th {} declarations. The text-align: property is also relevant to these cells.

Adding a visible border element to a table can help it fit better aesthetically on a page and can also keep things looking more professional. Now adding a border-bottom: property to the td, th {} declaration will add a visible line under each cell, but you will still need to call out the th {} border on it’s own to have a border more definitive under the header cell.

One last thing that you can add to a simple table like this one is a tr: hover {} declaration and insert a slight color change when someone hovers their mouse over a cell. This is done through the use of a background: property which dictates color.

If you liked this quick tutorial on styling tables with CSS, you may also enjoy this recent post on understand and clearing floats with CSS. Thanks for stopping by!

Share and Enjoy !

0 0