We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Setting CSS Background Attributes

Visual Studio .NET 2003

Background attributes control the background either by changing its color or by including an image. If you use an image as the background for your Web page, you also can specify its position and tiling attributes. By combining these two attributes, you can determine the location on the page of the background image and how often the image displays.

To prepare to build a CSS background color style

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

    - or -

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

  2. On the Styles menu, choose Build Style.

    The Style Builder dialog box appears.

  3. Choose Background in the left pane.

To set a background color

  • Choose a color from the Color list or click the adjacent ellipses (...) button to open the Color Picker dialog box and select additional colors.

    If you select Transparent, the background becomes transparent and behaves as if you had not chosen a background color. The preview area at the bottom of the dialog box reflects the results of your selections.

To set a background image

  • Type a path to an image file or click the adjacent ellipsis (...) button to open the Select Background Image dialog box and navigate to a file.

To set tiling and scrolling attributes

  • Select tiling and scrolling values from corresponding drop-down lists.

    Scrolling attributes make it possible for you to determine whether the background image remains stationary as you scroll or whether the background image scrolls along with the text and graphics on the page.

To set position attributes

  • Select horizontal and vertical attributes from the corresponding drop-down lists.

    You must select both horizontal and vertical values. If you specify only one positioning value, the CSS editor inserts the incomplete style information and underlines it to indicate that it is incorrect. After you specify the other value, the editor completes the style.

To set custom position attributes

  1. Select Custom from the horizontal and vertical drop-down lists.
  2. Enter a value in the adjacent field, and choose a unit option.

    To disable your background image and its related attributes without losing these settings, select Do not use background image.

    Tip   Tiling and positioning attributes work together. By default, an image is placed in the upper-left corner of the document. If you accept the default position and tile horizontally, the image repeats along the top of the document. If you adjust the position attributes, you change the initial position of the image. Tiling attributes then are applied to the image based on the initial position set.

See Also

Background, Style Builder Dialog Box | Color Picker 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: