• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Working with Tables > Controlling Spacing, Padding, and Borders

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 draw a border around the table and its individual cells. Cell spacing is inserted outside of the border of a cell, and cell padding is inserted inside of the border of a cell.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint