Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: Browser defaultExternal style sheetInternal style sheet (inside the <head> tag)Inline style (inside an HTML element)- Taken from: http://www.w3schools.com/css/css_intro.asp
The directory structure:The active Master Page: <%@ Master Language="C#" EnableTheming="true" AutoEventWireup="true"CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>The Problems With Themes and Skins in ASP.NET 2.0</title> <asp:contentplaceholder id="ContentPlaceHolderHead" runat="server" /></head><body> <form id="form1" runat="server"> <h1>Hello World!</h1> </form></body></html>Note: the ASP Content Place Holder between the Head tags and "Hello World!" between the H1 tags.The default Web Form (.aspx page) providing the Content for the Master Page's Content Place Holder:<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPage.master"AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHead" Runat="Server"> <style type="text/css"> H1{ color: red; } </style></asp:Content>Note: the Style element between the ASP Content Place Holder tag - H1 should now be colored red.The contents of StyleSheet.css, the only CSS file in the Active Theme (App_Theme) directory:H1{ color: blue;}Note: H1 should still be red because Internal style sheets are supposed to have priority over External style sheets. The rendered XHTML:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>The Problems With Themes and Skins in ASP.NET 2.0</title> <style type="text/css"> H1{ color: red; } </style> <link href="App_Themes/Default/StyleSheet.css" type="text/css" rel="stylesheet" /></head><body> <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..." /> </div> <h1>Hello World!</h1> </form></body></html>Note: the position of the External Style Sheet (the Link element) in relation to the Internal Style Sheet (the Style element) - the Internal style definition (color: red;) precedes the External style definition (color: blue;). The results in a web browser:Note: according to the style sheet priorities in the W3C guidelines (see above) "Hello World!" should be colored red not blue - the Internal Style should be applied before the External Style; however, this is not the case.
The active Master Page: <%@ Master Language="C#" EnableTheming="true" AutoEventWireup="true"CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>The Problems With Themes and Skins in ASP.NET 2.0</title>
<asp:contentplaceholder id="ContentPlaceHolderHead" runat="server" />
</head><body> <form id="form1" runat="server">
<h1>Hello World!</h1>
</form></body></html>Note: the ASP Content Place Holder between the Head tags and "Hello World!" between the H1 tags.
The default Web Form (.aspx page) providing the Content for the Master Page's Content Place Holder:<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPage.master"AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHead" Runat="Server">
<style type="text/css"> H1{ color: red; } </style>
</asp:Content>Note: the Style element between the ASP Content Place Holder tag - H1 should now be colored red.
The contents of StyleSheet.css, the only CSS file in the Active Theme (App_Theme) directory:H1{ color: blue;}Note: H1 should still be red because Internal style sheets are supposed to have priority over External style sheets.
The rendered XHTML:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>The Problems With Themes and Skins in ASP.NET 2.0</title>
<style type="text/css"> H1{ color: red; } </style> <link href="App_Themes/Default/StyleSheet.css" type="text/css" rel="stylesheet" />
</head><body> <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..." /> </div>
</form></body></html>Note: the position of the External Style Sheet (the Link element) in relation to the Internal Style Sheet (the Style element) - the Internal style definition (color: red;) precedes the External style definition (color: blue;).
The rendered XHTML:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>The Problems With Themes and Skins in ASP.NET 2.0</title> <style type="text/css"> H1{ color: red; } </style> <link href="App_Themes/Default/StyleSheet.css" type="text/css" rel="stylesheet" /></head><body> <style type="text/css" media="screen"> H1{ color: green; } </style> <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..." /> </div> <h1>Hello World!</h1> </form></body></html>Note: the Style element (color: green;)inside the Body tag. The results in a web browser:Note: "Hello World!" is green as expected.
<html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>The Problems With Themes and Skins in ASP.NET 2.0</title> <style type="text/css"> H1{ color: red; } </style> <link href="App_Themes/Default/StyleSheet.css" type="text/css" rel="stylesheet" /></head><body>
<style type="text/css" media="screen"> H1{ color: green; } </style>
<form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..." /> </div> <h1>Hello World!</h1> </form></body></html>Note: the Style element (color: green;)inside the Body tag.
Cons:It's not a recommended best practice, but is used by some of the larger sites like Amazon and Yahoo!It's not valid XHTML (but neither are iframes in XHTML Strict)Pros:Can use Microsoft’s Conditional CommentsCan use the CSS @Import ruleCan use the CSS @Media ruleCan use multiple CSS Media typesCan easily use Media-dependent cascadesCan easily control the CSS load order (inheritance and cascading)It's fairly intuitive and understandableIt's compatible with Revision Control Systems