HTML and CSS Reference
Table cells look like they just
use the box model too…they've
got padding and a border. Do they
also have a margin?
Table cells do have padding and a border — just like
you've seen in the box model — but they are a little
different when it comes to margins.
The box model is a good way to think about table cells, but they do
differ when it comes to margins. Let's take a look at one of the cells
in Tony's table:
Here's t he content.
A nd here's
W e call the space in between
t he cells border-spacing.
This is just like the
property we us ed in
the CSS table display
layout for Sta rbuzz.
So instead of a margin, we have a border-spacing property, which
is defined over the entire table. In other words, you can't set the
“margin” of an individual table cell; rather, you set a common spacing
around all cells.