Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Applying a CSS Style to Another Web Page

Visual Studio .NET 2003

To use CSS styles from a page you like on a different Web page, you can either copy and paste CSS style definitions from within the <STYLE></STYLE> block of the first HTML document to the <STYLE></STYLE> block of the second or create an external CSS style sheet to be shared by several documents.

Tip   If several Web pages will share the same CSS styles, then place these styles in an external CSS style sheet. Insert a LINK to this style sheet within the <HEAD> section of each HTML document that follows this form:
<LINK REL="stylesheet" TYPE="text/css" HREF="MyStyles.css">
MyStyles.css is the name of your external CSS style sheet.

To copy and paste a CSS style from an HTML document

  1. Open both the source document that includes the desired CSS style and the target document that also will use this style in HTML view.
  2. Locate the style that you want to copy within the <STYLE></STYLE> block in the <HEAD> section of the source document, and copy it.
  3. Paste the CSS style into the <STYLE></STYLE> block within the <HEAD> section of the target HTML document.
    Note   You also can copy the entire <STYLE></STYLE> block from the <HEAD> section of one Web page and paste it into the <HEAD> section of another. However, you might prefer to relocate shared CSS styles to an external style sheet.

To copy and paste CSS styles into an external CSS style sheet

  1. Create a new CSS style sheet in your project, or open an existing one.
  2. Open the source document that has the desired CSS styles in HTML view.
  3. Copy the desired CSS styles from within the <STYLE></STYLE> block in the <HEAD> section of the document, and paste them into the external CSS style sheet.
  4. Within the <HEAD> section of an HTML document that will use these styles, add a link to this external CSS style sheet that follows this form:
    <LINK REL="STYLESHEET" TYPE="text/css" HREF="MyStyles.css"> 
    

    MyStyles.css is the name of your external CSS style sheet.

  5. Then, you can delete the styles copied from the <STYLE> block if desired.

    The styles relocated to the external CSS style sheet are now available for use on as many Web pages as you want. Place a <LINK> in the <HEAD> portion of each page that uses these styles to the external CSS style sheet.

See Also

Creating an External CSS Style Sheet | Linking a Web Page to a CSS Style Sheet | 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

Show:
© 2014 Microsoft