The HTML source automatically generated by ASP.NET 2.0 Themes (note the lack of media attributes):<head> <title>The Problems With Themes and Skins in ASP.NET 2.0 </title> <link href="App_Themes/Default/HandHeld.css" type="text/css" rel="stylesheet" /> <link href="App_Themes/Default/Print.css" type="text/css" rel="stylesheet" /> <link href="App_Themes/Default/Screen.css" type="text/css" rel="stylesheet" /> </head> My desired HTML source (note the media attributes in bold):<head> <title>The Problems With Themes and Skins in ASP.NET 2.0 </title> <link href="App_Themes/Default/Default.css" type="text/css" rel="stylesheet" media="all" /> <link href="App_Themes/Default/HandHeld.css" type="text/css" rel="stylesheet" media="handheld" /> <link href="App_Themes/Default/Print.css" type="text/css" rel="stylesheet" media="print" /> <link href="App_Themes/Default/Screen.css" type="text/css" rel="stylesheet" media="screen" /> </head>
<head> <title>The Problems With Themes and Skins in ASP.NET 2.0 </title> <link href="App_Themes/Default/HandHeld.css" type="text/css" rel="stylesheet" /> <link href="App_Themes/Default/Print.css" type="text/css" rel="stylesheet" /> <link href="App_Themes/Default/Screen.css" type="text/css" rel="stylesheet" /> </head>
<head> <title>The Problems With Themes and Skins in ASP.NET 2.0 </title> <link href="App_Themes/Default/Default.css" type="text/css" rel="stylesheet" media="all" /> <link href="App_Themes/Default/HandHeld.css" type="text/css" rel="stylesheet" media="handheld" /> <link href="App_Themes/Default/Print.css" type="text/css" rel="stylesheet" media="print" /> <link href="App_Themes/Default/Screen.css" type="text/css" rel="stylesheet" media="screen" /> </head>
Cons:Can’t use Microsoft’s Conditional CommentsCan’t use the CSS @Import ruleCan’t use the CSS @Media ruleCan’t easily use multiple CSS Media typesCan’t easily control CSS preferred and alternate style sheetsCan’t easily control the CSS load order (inheritance and cascading) Contributes to a fragile environmentNot intuitive – a maintenance programmers nightmare - “I know CSS, but Where are the Media types defined and How are they controlled?”Pros:Can define a single Media type for all .css files relatively easyCould define multiple Media types - with more complex logic dependant on .css file namingCould control CSS preferred and alternate style sheets - with more complex logic dependant on .css file namingCompatible with Revision Control Systems (CVS, Subversion, Visual Source Safe, and so on)