Controlling Spacing, Padding, and Borders

In the example HTML file for this chapter, a border="1" attribute is set in the TABLE element, causing a one-pixel border to be drawn around the table and its cells. This is included to help you visualize how cell spacing and padding is controlled in HTML and CSS. By default, browsers do not draw borders for tables, but they do insert spacing between cells (usually two pixels) and padding within cells (usually one pixel).

Controlling Spacing, Padding, and Borders with HTML

In HTML, the TABLE element's CELLSPACING and CELLPADDING attributes are used to set the amount of spacing that is displayed be- tween cells and the amount of padding that is inserted inside of cells. The BORDER attribute is used to ...

Get Cascading Style Sheets (CSS) by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.