This documentation is archived and is not being maintained.

Setting CSS Margin and Padding Attributes

Visual Studio .NET 2003

Margin attributes set the distance outward from the edges of the space used by an element to the adjoining elements on the page. Padding attributes set the distance inward from the edges of the space used by an element to the content displayed within its reserved space.

To prepare to build a CSS margin or padding style

  1. Open an external CSS style sheet document for editing, and follow the procedures in the topic Building CSS Styles.

    - or -

    Open a Web page for editing in Design view, and follow the procedures in the topic Inserting CSS Styles from the Document Styles Window.

  2. On the Styles menu, choose Build Style.

    The Style Builder dialog box appears.

  3. Choose Edges in the left pane.

To set margin attributes

  1. Type values in the Margins in the Top, Bottom, Left, and Right fields.
  2. Accept the default unit option or select another unit option.

    When you enter a value in a field, the default unit option, px (pixels), is automatically entered in the unit option field.

To set padding attributes

  1. Type values in the Padding in the Top, Bottom, Left, and Right fields.
  2. Accept the default unit option or select another unit option.

    If you select percent (%) both as the unit option on the Edges page and as the Height and Width option on the Position page, then the size and position of the element will be relative to the available display space in the Web browser.

See Also

Setting CSS Text Attributes | Insert Table Dialog Box | Working With CSS Styles | Introduction to Cascading Style Sheets | Building CSS Styles | Adding CSS Style Attributes in Design View | Inserting CSS Styles from the Document Styles Window | Creating an External CSS Style Sheet

Show: