University of Utah

Table Margins and Padding

Updated on

If you would like to customize the space in and around your table beyond what is available in the RCE, you may need to manually add or adjust table margins and padding. Cell spacing and padding can be specified in the RCE using the general table properties menu. Table margins, table and caption padding are not found in the RCE and needs to be added or changed in code.

Table Margins

Margin is the space around the outside of a table. Table, caption, row and cell margins can be changed with the margin attribute followed by a measurement in em, pixels, percentage, auto, or 0. Negative numbers can be used with the margin attribute. You may also use margin-right, margin-left to specify margins in code.

Table Padding

Padding is the space inside the border between the border and the text and can aid readability. Table, caption, row and cell padding can be changed with the padding attribute followed by a measurement in em, pixels, percentage, auto, or 0. Values follow the same pattern as with margin values.

Reading the Measurements

Each of the four sides of the cell can be specified separately with measurements starting at the top, right, bottom, then left. For example, (margin: 3em auto 3em auto) would provide a 3em margin on top, automatic on the right, 3em on the bottom, and automatic on the left). The order of the numbers is important.

If

  • four values are declared, these are values for top, right, bottom, left;
  • three values are declared, these are values for top, left-right, and bottom;
  • two values are declared, these are values for top-bottom and left-right;
  • one value is declared, the same value is to be applied to all sides.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Previous Article Table Code Basics
Next Article Table Borders and Shading