This documentation is archived and is not being maintained.

How to: Add Cascading Style Sheet Attributes in Design View

As you edit a Web page in Design view of the HTML Designer in Visual Web Developer, you can add cascading style sheets (CSS) style attributes to controls or to HTML elements.

To add CSS style attributes to an HTML element

  1. In Design view, right-click the control or HTML element to which you want to add a style attribute, and then click Style.

    NoteNote

    The Style command is available only if the currently selected browser schema is set to a browser that supports styles.

  2. In the Style Builder dialog box, add values for the CSS style attributes that you want.

    CSS attribute:value pairs are added to a style="" declaration, which is inserted into the opening tag of the selected HTML element. The following code example shows inline style attributes that are applied to an <h3> heading:

    <h3 style="text-decoration:underline; color:red;">Important</h3>
    
    NoteNote

    When you apply an inline CSS style to one HTML element, you have not changed the style for all such elements. In the preceding example, the added CSS style attributes apply to just one h3 element. Other h3 headings will continue to display the default style.

To apply an existing CSS style class to an HTML element

  1. In Design view, select the control or HTML element to which you want to apply an existing style class.

  2. In the Properties window for the selected element, type the class name in the CssClass box.

    A class attribute is added to the opening tag of the selected element.

See Also

Show: