Chapter 8. Padding, Borders, and Margins
structure for an entire page's
appearance. You might even use tables for simpler tasks, like putting
text in a colored box with a border. When you think about it, though,
you shouldn't need a table for such simple tasks. If
you want only a paragraph with a red border and a yellow background,
shouldn't creating it be easier than wrapping a
single-cell table around it?
The authors of CSS felt it should, indeed, be easier, so they devoted
a great deal of attention to allowing you to define
borders for
paragraphs, headings, div or any
number of other things.
CSS also lets you define regions around an element that control how
the border is placed in relation to the content and how close other
elements can get to that border. Between the content of an element
and its border, we find the
padding
of an element, and beyond the border, the
margins.
These properties affect how the entire document is laid out, of
course, but more importantly, they very deeply affect the appearance
of a given element.
|