How to: Link Cascading Style Sheets to ASP.NET Web Pages (Visual Studio)

After you have defined an external cascading style sheet (CSS), perhaps using the procedure in How to: Create External Cascading Style Sheets (Visual Studio), you can link the style sheet to individual ASP.NET Web pages to apply the styles to the elements on the page. Style sheets allow you to specify formatting styles for HTML elements.

To link a cascading style sheet to an ASP.NET Web page

  • In Design view, from Solution Explorer, drag the style sheet file (.css file) and drop it anywhere on the Web page.

    —or—

  • In Source view, from Solution Explorer, drag the style sheet file (.css file) and drop it within the <head></head> tags on the Web page.

    A new link element is inserted inside the <head> tags, which might look like the following code example.

    <link href="MyStyles.css" rel="stylesheet" type="text/css" />
    

See Also

Community Additions

ADD
Show: