<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Adam.Kahtava.com / AdamDotCom &#187; CSS</title>
	<atom:link href="http://adam.kahtava.com/journal/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://adam.kahtava.com/journal</link>
	<description>A software development blog</description>
	<pubDate>Fri, 12 Mar 2010 03:41:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Project Badge: Show The World Your GitHub and Google Code Projects On Your Blog</title>
		<link>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/</link>
		<comments>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 17:00:10 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[ADC Services]]></category>

		<category><![CDATA[ADC Website]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=2298</guid>
		<description><![CDATA[ 
The Project Badge displays your GitHub and Google Code projects in a badge that can be displayed on your site. This widget was built on the data being returned from my Open Source Service. 
View this post outside your RSS reader to see it in action or view it here.
The source for the Project [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://adam.kahtava.com/etcetera/open-source-project-badge/" style="border-width: 0px; width: 320px; height: 370px; margin-left: 15px; float: left;"> </iframe></p>
<p>The Project Badge displays your GitHub and Google Code projects in a badge that can be displayed on your site. This widget was built on the data being returned from my <a href="http://adam.kahtava.com/journal/2010/02/11/introducing-my-open-source-projects-service-grab-your-project-details-from-github-or-google-code/">Open Source Service</a>. </p>
<p><em>View this post outside your RSS reader to see it in action or view it <a href="http://adam.kahtava.com/etcetera/open-source-project-badge/">here</a>.</em></p>
<p>The source for the Project Badge can be found <a href="http://github.com/AdamDotCom/project-badge/">here</a> and the source for the accompanying service can be found <a href="http://code.google.com/p/adamdotcom-services/source/browse/trunk#trunk/AdamDotCom.OpenSource.Service/Source/Service">here</a>. A list of all my publicly available web services can be found <a href="http://adam.kahtava.com/publicly-available-web-services/">here</a>.</p>
<div style="clear:both;"></div>
<h3>Using The Project Badge On Your Website or Blog</h3>
<p><strong>1. Add The Asset References</strong></p>
<p>Add the following asset references, and a reference to jQuery (if you don't have one already).</p>
<div class="syntax_hilite">
<div id="html-4">
<div class="html"><span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://github.com/AdamDotCom/project-badge/raw/master/project-badge.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://github.com/AdamDotCom/project-badge/raw/master/projectBadge.js"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</div>
</div>
<p></p>
<p><strong>2. Configure Your Accounts</strong></p>
<p>Set your project accounts (it's OK if you only use one host) then optionally set the appropriate filters - in my case <a href="http://code.google.com/u/adam.kahtava.com/">my Google Code projects</a> were prefixed with <em>adamdotcom</em> and I had duplicate projects on both GitHub and Google Code. By specifying <em>remove:adamdotcom,remove:duplicate-items</em> in my filters I filter out the duplicates and removed <em>adamdotcom</em> from the project name.</p>
<div class="syntax_hilite">
<div id="javascript-5">
<div class="javascript">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&nbsp; projectBadge.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; gitHub: <span style="color: #3366CC;">'AdamDotCom'</span>, <br />
&nbsp; &nbsp; &nbsp; googleCode: <span style="color: #3366CC;">'adam.kahtava.com'</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>,<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; filters: <span style="color: #3366CC;">'remove:adamdotcom,remove:duplicate-items,remove:-'</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&lt;/script&gt;</div>
</div>
</div>
<p></p>
<p><strong>3. Add The Widget Hook</strong><br />
Add an element to your site or blog with the id of <code>project-badge</code>.</p>
<div class="syntax_hilite">
<div id="html-6">
<div class="html"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"project-badge"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
&nbsp; Loading...<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</div>
</div>
<p></p>
<p><strong>That's it!</strong><br />
If you have any issues, use the <a href="http://adam.kahtava.com/etcetera/open-source-project-badge/">the working example</a> as a reference, or send me a message.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Book Reviewed: Designing with Web Standards by Jeffrey Zeldman</title>
		<link>http://adam.kahtava.com/journal/2009/07/20/book-reviewed-designing-with-web-standards/</link>
		<comments>http://adam.kahtava.com/journal/2009/07/20/book-reviewed-designing-with-web-standards/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 16:00:08 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[Book]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Review]]></category>

		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1750</guid>
		<description><![CDATA[
The title of Jeffrey Zeldman's book (Designing with Web Standards)Â says it all - this book promoted accessible, usable, search engine friendly web design and development through the use of XHTML and CSS whileÂ debunking the myths surrounding web standards.Â ZeldmanÂ is a wellÂ recognized nameÂ among web developers and designers - he's the theÂ founder ofÂ A List Apart, and co-founder ofÂ The [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right;"><a href="http://www.amazon.com/Designing-Web-Standards-Jeffrey-Zeldman/dp/0321385551/"><img class="alignright" title="Designing with web standards" src="http://ec1.images-amazon.com/images/P/0321385551.01._SCMZZZZZZZ_.jpg" alt="" width="131" height="160" /></a></div>
<p>The title of <a href="http://en.wikipedia.org/wiki/Jeffrey_Zeldman">Jeffrey Zeldman's</a> book (<a href="http://www.amazon.com/Designing-Web-Standards-Jeffrey-Zeldman/dp/0321385551">Designing with Web Standards</a>)Â says it all - this book promoted accessible, usable, search engine friendly web design and development through the use of XHTML and CSS whileÂ debunking the myths surrounding web standards.Â ZeldmanÂ is a wellÂ recognized nameÂ among web developers and designers - he's the theÂ founder ofÂ <a href="http://www.alistapart.com/">A List Apart</a>, and co-founder ofÂ <a href="http://www.webstandards.org/">The Web Standards Project (WaSP)</a>.Â His writing is entertaining, witty, easy to read, and insightful - it's very much like the content we're used to reading at <a href="http://www.alistapart.com/">A List Apart</a>.Â It's also fair to mention that this book hasÂ been edited by industy experts and influencial writers likeÂ <a href="http://en.wikipedia.org/wiki/Eric_Meyer">Eric Myer</a>.Â Any developer that works with the web should read this book along with <a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742">JavaScript: The Good Parts</a> by Douglas Crockford.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/07/20/book-reviewed-designing-with-web-standards/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Chronic Divitis And Classitis, What Are They?</title>
		<link>http://adam.kahtava.com/journal/2009/07/15/cronic-divitis-and-classitis-what-is-it/</link>
		<comments>http://adam.kahtava.com/journal/2009/07/15/cronic-divitis-and-classitis-what-is-it/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 16:00:16 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Google Exercise]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1716</guid>
		<description><![CDATA[Jeffery Zeldman offers this entertaining definition for Divitis and Classitis:
Classitis is the measles of markup, obscuring meaning as it adds needless weight to every page. The affliction dates back to the early days of semi-CSS-capable browsers and the many designers' initially childish comprehension of how CSS works.
Alas, many have not yet outgrown that childish misunderstanding [...]]]></description>
			<content:encoded><![CDATA[<p>Jeffery Zeldman offers this entertaining definition for Divitis and Classitis:</p>
<blockquote><p><strong>Classitis is the measles of markup</strong>, obscuring meaning as it adds needless weight to every page. The affliction dates back to the early days of semi-CSS-capable browsers and the many designers' initially childish comprehension of how CSS works.<br />
Alas, many have not yet outgrown that childish misunderstanding of CSS ... Classitis is as bad in its own way as the <code>&lt;font&gt;</code> tag ever was; rarely does good markup require it ... At other times classitis is exacerbated by a still more serious condition ... divitis ...<strong> Classitis and divitis are like the needless adjectives with wich bad writing is strewen</strong>. They are the weeds in the garden of meaning. - Jeffrey Zeldman, <a href="http://www.amazon.com/Designing-Web-Standards-Jeffrey-Zeldman/dp/0321385551/">Designing with Web Standards</a></p></blockquote>
<p><strong>An example of markup wraught with divitis and classitis:</strong><br />
<img class="alignnone size-full wp-image-1720" style="padding-left: 5px;" title="googleexercise-divitis1" src="http://adam.kahtava.com/journal/wp-content/uploads/2009/07/googleexercise-divitis1.png" alt="googleexercise-divitis1" width="470" height="455" /><br />
<em>13 <code>div</code> elements and 11 classes for a single item. What a stench! :) Â <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/">View this markup in action.</a></em></p>
<p><strong>The equivalent markup disease free:</strong><br />
<img class="alignnone size-full wp-image-1721" style="padding-left: 5px;" title="googleexercise-semantic" src="http://adam.kahtava.com/journal/wp-content/uploads/2009/07/googleexercise-semantic.png" alt="googleexercise-semantic" width="519" height="360" /><br />
<em>Cleaner, more meaningful, and with all the functionality of the former code.Â One <code>div</code> element and 3 classes for a single item.Â Â ShamWow!Â <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/">View this markup in action.</a></em></p>
<p>Both of these markup snippets are visually and functionally equivalent. In the first example the <code>divs</code>, <code>classes</code>, and cryptic <code>ids</code> weigh down the page and pollute the meaning of the markup. In the later, a more semantic / structural approach is taken Â Both these snippets were pulled from my attempts at <a href="http://adam.kahtava.com/journal/2009/07/09/the-google-exercise-revisited-semantic-markup-with-jquery/">the Google Web Developer Exercise.</a></p>
<p>Clean meaningful markup is the API that users and web crawlers consume - it's important and easy to keep things clean, it just takes a little experience. Thank goodness for patterns like <a href="http://en.wikipedia.org/wiki/Modelâ€“viewâ€“controller">MVC</a> that let us control our API (the markup).</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/07/15/cronic-divitis-and-classitis-what-is-it/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What Is Semantic / Structural Markup and Why Does It Matter?</title>
		<link>http://adam.kahtava.com/journal/2009/07/13/what-is-semantic-structural-markup-and-why-does-it-matter/</link>
		<comments>http://adam.kahtava.com/journal/2009/07/13/what-is-semantic-structural-markup-and-why-does-it-matter/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:00:02 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1695</guid>
		<description><![CDATA[I always found the definition of "Semantic / Structural Markup" murky on the intertubes. I thought Jeffrey Zeldman described it well in his book Designing with Web Standards.

What Is Semantic / Structural Markup?
Markup is "semantic" when tags are chosen according to what they mean. For example, tagging a headline h1 because it is the most [...]]]></description>
			<content:encoded><![CDATA[<p>I always found the definition of "Semantic / Structural Markup" murky on the intertubes. I thought Jeffrey Zeldman described it well in his book <a href="http://www.amazon.com/Designing-Web-Standards-Jeffrey-Zeldman/dp/0321385551/">Designing with Web Standards</a>.<br />
<strong></strong></p>
<p><strong>What Is Semantic / Structural Markup?</strong></p>
<blockquote><p><strong>Markup is "semantic" when tags are chosen according to what they mean.</strong> For example, tagging a headline <code>h1</code> because it is the most important headline on the page is a semantic authoring practice. Tagging a headline <code>h1</code> "to make it look big" is not. ... I use the phrase "structural markup" to mean pretty much the same thing as "semantic markup." ("Structural markup" takes its name specifically from the idea that the web document has an outline-like structure.) - Jeffrey Zeldman,Â <a href="http://www.amazon.com/Designing-Web-Standards-Jeffrey-Zeldman/dp/0321385551/">Designing with Web Standards</a></p></blockquote>
<p>Zeldman goes on to make many great points on why semantic markup matters, here's my paraphrase.</p>
<p><strong>Why Does Semantic / Structural Markup Matter?</strong></p>
<ul>
<li>it helps make web sites more <a href="http://en.wikipedia.org/wiki/Web_accessibility">accessibile</a></li>
<li>it provides a means to meet <a href="http://en.wikipedia.org/wiki/Web_accessibility#Guidelines_on_accessible_web_design">government mandatied web accessibility guidelines</a></li>
<li>it's a critical component for <a href="http://en.wikipedia.org/wiki/Search_engine_optimization">Search Engine Optimization (SEO)</a> because <em><strong>the Google search engine is the biggest blind user on the web</strong></em> - Zeldman</li>
<li>doing the right thing is the right way to do things -Â developers should have aÂ sense of prideÂ in being a craftsman :)</li>
<li>did I mention Search Engine Optimization?</li>
</ul>
<p>If you're interested in learning more about semantic markup then view <a href="http://www.alistapart.com/">A List Apart's</a> source code, or read their many online resources:Â <a href="http://www.alistapart.com/topics/topic/htmlxhtml/">Topics: Code: HTML and XHTML</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/07/13/what-is-semantic-structural-markup-and-why-does-it-matter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Google Exercise Revisited: Semantic Markup with jQuery</title>
		<link>http://adam.kahtava.com/journal/2009/07/09/the-google-exercise-revisited-semantic-markup-with-jquery/</link>
		<comments>http://adam.kahtava.com/journal/2009/07/09/the-google-exercise-revisited-semantic-markup-with-jquery/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:00:23 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Google Exercise]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming Languages]]></category>

		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1641</guid>
		<description><![CDATA[A couple years ago I tried getting a Web Developer position at Google. After a few interviews they had me complete their Web Developer exercise. I did it, and my initial submission would have made any respectable web developer ill - you can read more here: Getting a Job at Google: A Web Developer Fizzbuzz. [...]]]></description>
			<content:encoded><![CDATA[<p>A couple years ago I tried getting a Web Developer position at Google. After a few interviews they had me complete their Web Developer exercise. I did it, and my initial submission would have made any respectable web developer ill - you can read more here: <a href="http://adam.kahtava.com/journal/2008/05/24/getting-a-job-at-google-a-web-developer-fizzbuzz/">Getting a Job at Google: A Web Developer Fizzbuzz</a>. I <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/">redid the exercise</a> over a year ago, but today even that code stink.</p>
<p><strong>I did the exercise yet again (the third time) because my last attempt needed some improvements:</strong></p>
<ul>
<li>it suffered from <a href="http://adam.kahtava.com/journal/2009/07/15/cronic-divitis-and-classitis-what-is-it/">chronic classitis and divitis</a> (too many classes, ids, and divs were making me itchy)</li>
<li>it wasn't really using <a href="http://brainstormsandraves.com/articles/semantics/structure/">semantic / structural</a> markup (all the extra divs etc... cluttered my markup, and some of my class names like <code>container-borders</code> are non-semantic altogether)</li>
<li>it performed poorly and wasn't accessible (everything was being rendered in the DOM, there was no immediate rendered markup which kind of violated the idea of <a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">unobtrusive JavaScript</a>, nor was it screen reader friendly)</li>
<li>it wasn't making use of any JavaScript libraries to abstract browser inconsistencies out of the code</li>
<li>it suffered from my <a href="http://adam.kahtava.com/journal/2008/02/17/software-ethnocentrism-staving-off-tunnel-vision/">software ethnocentrism</a> (my variable and object naming like <code>GoogleExercise</code> was mirroring statically typed languages and not the native language they were being written in)
</ul>
<p><strong>Here's my latest Google Exercise (addressing all the above concerns):</strong><br />
<iframe src="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/" style="border-width: 0px; width: 320px; height: 300px; margin-left: 15px; float: left;"> </iframe><em>View this post outside your RSS reader to see it in action or view it <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/">here</a>.</em></p>
<p>This attempt makes use of <a href="http://jquery.com/">jQuery</a> and uses 57 lines of JavaScript (almost 200 lines less from my last one). </p>
<p>You can view the code for this attempt here: <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/google.contact.widget.js">google.contact.widget.js</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/index.html">index.html</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/semantic-with-jquery/google-contact-widget.css">google-contact-widget.css</a>. </p>
<p>You can view the old code here: <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/GoogleExercise.js">GoogleExercise.js</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/index.html">index.html</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/GoogleExercise.css">GoogleExercise.css</a>.</p>
<p>If you think I can improve on my code then let me know. Oh yeah, and if you're a recruiter from Google then hire me! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/07/09/the-google-exercise-revisited-semantic-markup-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cross Language Naming Conventions: Avoiding Verbosity In The Presentation Layer</title>
		<link>http://adam.kahtava.com/journal/2008/08/29/cross-language-naming-conventions-avoiding-verbosity-in-the-presentation-layer/</link>
		<comments>http://adam.kahtava.com/journal/2008/08/29/cross-language-naming-conventions-avoiding-verbosity-in-the-presentation-layer/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 22:17:38 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming Languages]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,3a071811-8e92-4511-a2e3-e4501864e82d.aspx</guid>
		<description><![CDATA[
Most languages and technologies used in web applications come with their own unique naming conventions - which is unfortunate, but necessary, because diversity is important. Languages like JavaScript and PHP use camelCase, CSS uses-hyphenated-delimiters, and ASP.NET / Java / and the like adhere to the conventions used in their respective libraries and frameworks. Managing the [...]]]></description>
			<content:encoded><![CDATA[<div style="padding: 5px; float: right;"><a href="http://www.flickr.com/photos/jimmysmith/135368590/"><img style="border: 0px none ;" src="http://farm1.static.flickr.com/56/135368590_cb5abe1793_m.jpg" alt="" /></a></div>
<p>Most languages and technologies used in web applications come with their own unique naming conventions - <em>which is unfortunate, but necessary, because diversity is important</em>. Languages like JavaScript and PHP use <a href="http://en.wikipedia.org/wiki/CamelCase">camelCase</a>, CSS <em>uses-hyphenated-delimiters</em>, and ASP.NET / Java / and the like adhere to the conventions used in their respective libraries and frameworks. Managing the different naming conventions in a web application can be difficult, but with discipline, embracing each language's conventions can provide some great benefits.</p>
<p>A common mistake I've made in the past, was trying to make all languages adhere to a single convention. <strong>As a budding PHP / ASP developer I took <em>the-single-convention-for-all-languages</em> approach</strong>. In retrospect, I used this approach because I didn't completely understand the language I was using, and in order to compensate for this lack of knowledge, I'd try to meld the languages into the mental model I understood best. <strong>This was a mistake.</strong></p>
<p>Today, I find that working with the conventions of the language facilitates re-use (<em>experts in the language understand what I'm doing</em>), promotes portability (<em>modules can be used across projects regardless of server-side technologies</em>), encourages global collaboration (<em>open source modules and plug-ins can be easily consumed and contributed to</em>), and helps to a nurture a more maintainable application (<em>developers from other language domains can easily maintain the application with a relatively small learning curve</em>). Like a carpenter working with fine material, <strong>I embrace working with the grain of each language</strong>. It's also fair to mention that breaking free from the monocultured (<em>one-size-fits-all</em>) approach to naming conventions provides a broader perspective, and also makes your development skills more universal - it might even open the door to different development domains in the future.</p>
<p>Then there's the discussion on name length, verbosity, and using meaningful names. Steve McConnell suggests that the optimum name size for a variable or function is between 8 and 20 characters (Chapter 11, <a href="http://www.amazon.ca/dp/0735619670/">Code Complete</a>), but with tools like <a href="http://en.wikipedia.org/wiki/ReSharper">ReSharper</a> (for renaming / refactoring etc...) I find myself using names well over 30 characters. So names like <em>GetApproveeTotalFromNamedBasket</em> are a common occurrence in my code. However, like most things, verbosity does need balance (everything in moderation right?). In the business layer, descriptive names are a godsend - they jog my memory as I rediscover what the module I wrote last month was supposed to do. But... in the presentation layer languages (like JavaScript, CSS,Â  ASP.NET, or XHTML) you may want to reconsider using long descriptive names. Since verbose, long running descriptive names in the presentation layer are passed over the network and can degrade performance. Often times these verbose names are combined together - throw in ASP.NET name mangeling, start hooking in verbose CSS definitions, and then start inserting JavaScript events. All this compounds quickly and result in large page payloads filled with elements like the following:</p>
<pre><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">&lt;div id=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;">"ctl00_ContentPlaceHolderForAllTheBestImprotantContent
 _PanelForTheBestReviews"</span>&gt;Â </span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">&lt;a onclick=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;">"LinkButtonClick_ThankYouForTakingTheTimeToReadThis();"</span>Â </span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"> id=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;">"ctl00_ContentPlaceHolderForAllTheBestImprotantContent_
 RepeaterForAllMyFavoriteBookReiews_ctl00_
 LinkButtonMarkReviewAsFavorite"</span>
<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"> class</span>=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;">"LinkFormatingCssClass SelectedLinkFormatingCssClass"</span>Â </span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"> href=<span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;">"javascript:__doPostBack(Â </span></span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;"> ctl00$ContentPlaceHolderForAllTheBestImprotantContent$Â </span></span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;"> RepeaterForAllMyFavoriteBookReiews$ctl00$LinkButtonMarkReviewAsFavorite'</span></span>
<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: #666666; background-color: #e4e4e4; font-family: Courier New; font-size: 11px;"> ,'')"</span>&gt;Mark As Favorite &lt;/a&gt; </span></pre>
<p>Note: <em>That mess of code above would fire a JavaScript event then an ASP.NET event. It's the result of</em><em> placing an ASP.NET LinkButton, inside a Repeater, inside a Panel, inside a Masterpage, and adding a JavaScript event along with some CSS. We can see that using long names in the presentation layers results in a mess of text. It's also fair to mention that the <a href="http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework">ASP.NET MVC Framework</a> lets developers write cleaner presentation code.</em><br />
Sure, everyone cites <em>premature optimization as the root of all evil</em>, and we <strong>do</strong> live in a world of <a href="http://en.wikipedia.org/wiki/Gzip">gzip file compression</a> and JavaScript <a href="http://en.wikipedia.org/wiki/Minify">minifiers</a>. But... keeping names short in CSS, ASP.NET, and XHTML isn't hard as long as you're mindful of the final goal. Smaller names in the presentation layer will reduce the amount of data transferred over the network which increase the performance of the application.</p>
<p>Joseph Smarr of Plaxo.com once said:</p>
<blockquote><p>Web applications are only slow if you let them get slow - <a href="http://channel9.msdn.com/posts/Charles/Douglas-Crockford-Alex-Russell-and-Joseph-Smarr-On-the-Past-Present-and-Future-of-JavaScript/">Douglas Crockford, Alex Russell and Joseph Smarr: On the Past, Present and Future of JavaScript</a> [30:00]</p></blockquote>
<p><strong>My preference (project requirements warranting) is to keep things short and concise in the presentation languages while using longer descriptive names outside the presentation languages. What's your preference?</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/08/29/cross-language-naming-conventions-avoiding-verbosity-in-the-presentation-layer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Book Reviewed: JavaScript: The Good Parts by Douglas Crockford</title>
		<link>http://adam.kahtava.com/journal/2008/06/07/book-reviewed-javascript-the-good-parts-by-douglas-crockford/</link>
		<comments>http://adam.kahtava.com/journal/2008/06/07/book-reviewed-javascript-the-good-parts-by-douglas-crockford/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 23:32:33 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[Book]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming Languages]]></category>

		<category><![CDATA[Review]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,6b653e5a-27a0-4fc6-bd15-85cd9c414372.aspx</guid>
		<description><![CDATA[Weighing in at 140+ pages of content, JavaScript: The Good Parts [Douglas Crockford] cuts through the obscurities, pleasantries, and filler found in most technical books. Instead, this book dives straight into the heart of the JavaScript language. It presents the clearest comprehensive explanation of what makes JavaScript a great programming language that I've encountered to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/0596517742/?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596517742"><img style="border-width: 0px; float: right;" src="http://ecx.images-amazon.com/images/I/51Mb1xCr7CL._SL500_AA240_.jpg" alt="" /></a>Weighing in at 140+ pages of content, <a href="http://www.amazon.com/gp/product/0596517742/?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596517742">JavaScript: The Good Parts [Douglas Crockford]</a> cuts through the obscurities, pleasantries, and filler found in most technical books. Instead, this book dives straight into the heart of the JavaScript language. It presents the clearest comprehensive explanation of what makes JavaScript a great programming language that I've encountered to date. It nails the important concepts, like JavaScript's: object oriented nature, its classless (pseudoclassical) nature, and functional nature. While covering the fundamentals like JavaScript's: functions, lexical scoping, lambdas, prototypal inheritance, and functional inheritance.</p>
<p>This book's size makes it approachable for all audiences, its style is terse and concise. This book has the potential to do for JavaScript, what Richie's inspirational classic the <a href="http://www.amazon.com/gp/product/0131103628/?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0131103628">C Programming Language</a> did for the C language.</p>
<p>JavaScript is the programming language of the web (AJAX), and this book will guide you through the good parts of this often misunderstood language - while this book is an excellent reference, it is not intended to replace <a href="http://adam.kahtava.com/journal/2008/03/26/book-reviewed-javascript-the-definitive-guide-by-david-flanagan/">JavaScript: The Definitive Guide</a>, you'll do best to have both these books on hand.</p>
<p>If you enjoyed (or are considering) this book then you may want to learn more of what Douglas Crockford has to say, check out his great JavaScript video series on the <a href="http://developer.yahoo.com/yui/theater/">YUI Theater</a>.</p>
<p>I highly recommend this book. View my review on <a href="http://www.amazon.com/gp/cdp/member-reviews/A2JM0EQJELFL69/ref=cm_pdp_reviews_see_all?ie=UTF8&amp;sort_by=MostRecentReview">Amazon</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/06/07/book-reviewed-javascript-the-good-parts-by-douglas-crockford/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on the perils of The ASP.NET AJAX Framework</title>
		<link>http://adam.kahtava.com/journal/2008/06/03/more-on-the-perils-of-the-aspnet-ajax-framework/</link>
		<comments>http://adam.kahtava.com/journal/2008/06/03/more-on-the-perils-of-the-aspnet-ajax-framework/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 15:06:27 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[ASP.NET AJAX]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,128d00d5-c819-417b-996f-268676243143.aspx</guid>
		<description><![CDATA[There's no need to whip a dead horse (I've probably been griping about the ASP.NET AJAX Framework for too long), but... Jon Galloway and a group of other notable gurus (K. Scott Allen, Scott Koon, and Kevin Dente) have started a podcast, their latest segment sparked my interest since it covered ASP.NET AJAX and AJAX [...]]]></description>
			<content:encoded><![CDATA[<p>There's no need to whip a dead horse (I've probably been griping about the ASP.NET AJAX Framework for too long), but... <a href="http://weblogs.asp.net/jgalloway/default.aspx">Jon Galloway</a> and a group of other notable gurus (<a href="http://www.odetocode.com/">K. Scott Allen</a>, <a href="http://www.lazycoder.com/">Scott Koon</a>, and <a href="http://weblogs.asp.net/kdente/">Kevin Dente</a>) have started a podcast, their latest segment sparked my interest since it covered ASP.NET AJAX and AJAX Libraries / Frameworks in general.</p>
<p>I share their sentiments so I thought I'd post a brief but choppy transcript:</p>
<blockquote><p>[ASP.NET AJAX] ... does offer some some nice features, they did try to take some of the common pieces of the CLR that [.NET Developers are] used to working with and move that down into a JavaScript library. So you get classes like a <a href="http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys.Net/WebRequestClass/default.aspx">WebRequest</a> class that wraps the <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a> ... and they have a <a href="http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys/StringBuilderClass/default.aspx">StringBuilder</a>, and they added methods that we're more accustom with ...</p>
<p>that's wonderful, but I don't find myself needing those extensions all that often.<strong> If you want to do strictly client-side programming then something like jQuery offers you a lot more capabilities to do things that you really want to do client-side like sorting and CSS selectors.</strong> ... That stuff is easy to do with an Update Panel and ASP.NET, but Update Panels aren't always the best solution to use. ...</p>
<p>the goals with ASP.NET AJAX was to integrate into the ASP.NET server-side model ... that's great for ASP.NET, but it needs more client-side features. ... It works if your thinking from the ASP.NET control perspective, but <strong>if you look at it outside the ASP.NET model there are a lot easier ways to do it. </strong>...</p>
<p>ASP.NET AJAX [development] seems to have come to a standstill I'm not seeing a lot of development in that area and the rest of these [AJAX] Frameworks are doing monthly releases. <strong>Every month that goes by [the ASP.NET AJAX Framework] falls further and further behind ... it needs to evolve.</strong></p></blockquote>
<p>Listen to this podcast here: <a href="http://weblogs.asp.net/jgalloway/archive/2008/05/29/technology-round-table-podcast-2-ajax-frameworks.aspx">Technology Round Table Podcast #2 - AJAX Frameworks</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/06/03/more-on-the-perils-of-the-aspnet-ajax-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting a Job at Google: A Web Developer Fizzbuzz</title>
		<link>http://adam.kahtava.com/journal/2008/05/24/getting-a-job-at-google-a-web-developer-fizzbuzz/</link>
		<comments>http://adam.kahtava.com/journal/2008/05/24/getting-a-job-at-google-a-web-developer-fizzbuzz/#comments</comments>
		<pubDate>Sat, 24 May 2008 21:03:23 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Google Exercise]]></category>

		<category><![CDATA[IE]]></category>

		<category><![CDATA[Interview]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,8cfd415e-f895-4115-8713-5a879e1abb15.aspx</guid>
		<description><![CDATA[Back when the web turned 2.0, AJAX was all the rage, and gas was cheap, a Google recruiter contacted me. We worked through a couple screening interviews - I explained how I was a .NET / ASP.NET / C# developer with some experience with Java and PHP, I described how C# was somewhat similar to [...]]]></description>
			<content:encoded><![CDATA[<p>Back when the web turned 2.0, AJAX was all the rage, and gas was cheap, a Google recruiter contacted me. We worked through a couple screening interviews - I explained how I was a .NET / ASP.NET / C# developer with some experience with Java and PHP, I described how C# was somewhat similar to Java. Things went great, I moved on to the next step of the process - writing code (a JavaScript widget for Gmail) with a 2 day (weekend) hard deadline. At the time I was wearing JavaScript diapers, but tried the exercise anyways - I&#39;m still convinced the recruiter confused my Java / C# experience with JavaScript. Anyhow... </p>
<p> <b>The Google Web Developer Exercise:<br /> </b><br />
<blockquote style="border: 1px solid rgb(207, 207, 207); padding-left: 7px;">
<h3>Web Developer Exercise </h3>
<p> Attached are three states of a new contacts widget. This widget will be used across Google and may be anywhere on the page. Designers will also use this in mocks for usability tests. Create the HTML, CSS, and JavaScript for the widget as described in the image. Your solution must work in Firefox v1.5+ and IE v6+. Bonus points for a solution that degrades nicely on older browsers.</p>
<p> <img src="http://adam.kahtava.com/journal/images/blog/GoogleExercise02.png"> <br /> <img src="http://adam.kahtava.com/journal/images/blog/GoogleExercise03.png"> <br /> <img src="http://adam.kahtava.com/journal/images/blog/GoogleExercise01.png">  </p></blockquote>
<p><b>After my first attempt, I concluded that: </b> <br /> 
<ol>
<li> My JavaScript knowledge was embarrassing  </li>
<li> <a href="http://en.wikipedia.org/wiki/Dynamic_language">Dynamic programming languages</a> like JavaScript using <a href="http://en.wikipedia.org/wiki/Prototype-based_programming">prototypical inheritance</a> were awesome - as a monocultured .NET developer I had sorely been missing out</li>
<li> Framework Web Developers (ASP.NET, Ruby on Rails, and so on) aren&#39;t really Web Developers - we depend on a framework (an API) as a crutch, where the law of <a href="http://en.wikipedia.org/wiki/Leaky_abstraction">Leaky Abstractions</a> is very real, and often when it rears it&#39;s head we use our <a href="http://en.wikipedia.org/wiki/Golden_hammer">golden hammer</a> (our multipurpose language of choice), but there are better tools at hand </li>
<li> Web Developers claiming <i>n</i> years of experience need to at least know JavaScript, CSS, HTML / XHTML, a server-side language, and some XML / XSL - NOT just a single multipurpose language or framework </li>
<li> Innovation can only happen when you become <i>one</i> with the technologies surrounding your realm - for example: <a href="http://adaptivepath.com/ideas/essays/archives/000385.php">Jesse James Garrett</a> probably would not have publicized AJAX had he been an exclusive ASP.NET developer. Diversity is essential for innovation </li>
</ol>
<p> In retrospect this exercise is brilliant, it&#39;s a more complex derivation of a <a href="http://www.codinghorror.com/blog/archives/000781.html">Fizzbuzz exercise</a>, which effectively weeds out the knowledgeable candidates from the n00bs. JavaScript is notorious for being one of <a href="http://www.crockford.com/javascript/javascript.html">the world&#39;s most misunderstood language</a>, many developer (and the ASP.NET Framework) still use JavaScript techniques from the old days of Netscape. For example: <i>&lt;a onclick="return false;" ...</i>, or &lt;a <i>href="Javascript: do something;" ...</i> are common <a href="http://en.wikipedia.org/wiki/DOM_Events#DOM_Level_0">DOM Level 0</a> inline techniques that should be avoided. These techniques have been replaced, but finding developer that use these JavaScript techniques can be hard.</p>
<p> <b>By having a developer complete this exercise you effectively determine that the they understands these concepts:</b> <br /> 
<ul>
<li> Cross browser compatibilities and work arounds for both JavaScript and CSS - with a preference given to <a href="http://www.quirksmode.org/js/support.html">feature detection (object detection)</a> vs browser detection, an understanding of the different event handling models between browsers </li>
<li> An understanding of the separation of concerns - JavaScript, markup, and CSS should be separate files, or at least separated within the document </li>
<li> Event registration and listening - <a href="http://en.wikipedia.org/wiki/DOM_Events">DOM events</a>, the different browser event models, no inline level 0 event declarations, no pseudo JavaScript protocol inline declarations within markup </li>
<li> An understanding of <a href="http://en.wikipedia.org/wiki/Functional_languages">functional languages</a> - <a href="http://en.wikipedia.org/wiki/Closure_%28computer_science%29">closures</a>, <a href="http://adam.kahtava.com/journal/2008/03/17/NamespacingYourJavaScript.aspx">namespaces</a>, <a href="http://en.wikipedia.org/wiki/Lambda_calculus">lambdas</a>, recursion where necessary </li>
<li> Node manipulation - creating, swapping, removing elements</li>
<li> Knowledge of <a href="http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/">non-obtrusive JavaScript techniques</a> </li>
<li> Importance of modular / compartmentalization of CSS and JavaScript - defensive programming techniques that minimize the risk of interfering with other scripts and elements within the page, part of the non-obtrusive techniques, how to avoid global variables</li>
<li> An understanding on how to debug JavaScript from both IE (<a href="http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html">link</a>) and Firefox (<a href="http://www.getfirebug.com/js.html">link</a>)</li>
<li> <a href="http://javascript.crockford.com/code.html">JavaScript code conventions</a> - naming conventions, statement conventions</li>
<li> CSS naming conventions</li>
<li> General DHTML / AJAX techniques - showing and hiding elements </li>
<li> A gauge on their attention to details and UI design intuition - what their gut tells them to do when things aren&#39;t spelled out</li>
</ul>
<p> <b>My latest crack at the Google Web Developer Exercise:</b>  <br /> <iframe src="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/" style="border-width: 0px; width: 320px; height: 300px; margin-left: 15px; float: left;"> </iframe> <br /> <i>You&#39;ll have to visit my site (view this blog post outside a RSS reader) to view the code in action.</p>
<p> </i>The code: <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/GoogleExercise.js">GoogleExercise.js</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/index.html">index.html</a>, <a href="http://adam.kahtava.com/etcetera/google-web-developer-exercises/non-semantic-pure-javascript/GoogleExercise.css">GoogleExercise.css</a> </p>
<p> <i>Today I&#39;m wearing JavaScript training wheels - </i><i>feel free to comment on the code, I&#39;m always looking for improvements and suggestions. I did take a couple shortcuts on the CSS / UI side of things as I was focusing more on the functionality.</i>  </p>
<p> <i>Using one of the <a href="http://en.wikipedia.org/wiki/Ajax_Libraries">AJAX Libraries</a> (like <a href="http://jquery.com/">jQuery</a>) we could certainly do this exercise in significantly fewer lines of code.</p>
<p> </i>
<div style="clear: both;">Today I still think about <a href="http://steve-yegge.blogspot.com/2008/03/get-that-job-at-google.html">Getting that job at Google</a>, Yahoo!, Amazon, or Microsoft. <a href="http://adam.kahtava.com/journal/2008/01/13/HowWellDoYouKnowJavaScript.aspx">How well do you know JavaScript?</a> </p></div>
<div style="border: 1px solid #ccccee; padding: 5px; background-color: #ffffdd;"><strong>Update:</strong> I redid the Google Exercise using jQuery and more semantics, you can find my latest version here: <a href="http://adam.kahtava.com/journal/2009/07/09/the-google-exercise-revisited-semantic-markup-with-jquery/">The Google Exercise Revisited: Semantic Markup with jQuery</a>.</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/05/24/getting-a-job-at-google-a-web-developer-fizzbuzz/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Free: Win a Copy of Beginning CSS: Cascading Style Sheets for Web Design</title>
		<link>http://adam.kahtava.com/journal/2008/04/24/free-win-a-copy-of-beginning-css-cascading-style-sheets-for-web-design/</link>
		<comments>http://adam.kahtava.com/journal/2008/04/24/free-win-a-copy-of-beginning-css-cascading-style-sheets-for-web-design/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 13:59:39 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[Book]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Contest]]></category>

		<category><![CDATA[DOM]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,0d25babc-9814-45bc-b73a-1951ac3d9b45.aspx</guid>
		<description><![CDATA[ Beginning CSS: Cascading Style Sheets for Web Design by Richard York is a great book for any web developer looking to thoroughly understand CSS.  
 This book was required pre-reading for my latest Technical Editing task - I&#39;m editing Mr. York&#39;s newest book. So in the spirit of spring, de-cluttering, and giving. I&#39;d [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/0470096977?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470096977"><img src="http://ecx.images-amazon.com/images/I/51e-K4w5wOL._AA240_SH20_.jpg" style="border: 0px none ; float: right;"></a> <a href="http://www.amazon.com/gp/product/0470096977?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470096977">Beginning CSS: Cascading Style Sheets for Web Design</a> by Richard York is a great book for any web developer looking to thoroughly understand CSS.  </p>
<p> This book was required pre-reading for my latest Technical Editing task - I&#39;m editing Mr. York&#39;s newest book. So in the spirit of spring, de-cluttering, and giving. I&#39;d like to give this book away. This book is like new with a couple minor dings (from an airport fiasco), it is in full color (like all good design books should be), and it&#39;s free!</p>
<p> <b>Contest Rules:</b> <br /> 
<ul>
<li> Comment on this post.</li>
<li> Leave a valid email in the email comment field.</li>
<li> The winner will be chosen at random and notified through email on <a href="http://en.wikipedia.org/wiki/Canada_day">Canada Day</a> (July 1st).</li>
<li> I pay for shipping.</li>
</ul>
<p> <strike>Good Luck!</strike> </p>
<p> The contest has ended and the winner is <span class="commentPermalinkStyle"><b>Devin Parrish</b>!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/04/24/free-win-a-copy-of-beginning-css-cascading-style-sheets-for-web-design/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The ASP.NET AJAX Learning Curve</title>
		<link>http://adam.kahtava.com/journal/2008/04/09/the-aspnet-ajax-learning-curve/</link>
		<comments>http://adam.kahtava.com/journal/2008/04/09/the-aspnet-ajax-learning-curve/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 14:36:06 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[ASP.NET AJAX]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,a8f6b8fe-dbc5-4963-a735-e92ad3b18d8b.aspx</guid>
		<description><![CDATA[The ASP.NET AJAX framework comes with a lot of baggage err... I mean... a huge learning curve when compared to other AJAX Frameworks like JQuery, YUI, Dojo, Prototype / Scriptaculous.
 Here&#39;s a running list of the technologies, and concepts you&#39;ll encounter when digging into ASP.NET AJAX: 

 ASP.NET 

 The Page Life Cycle
 The Control [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/ASP.NET_AJAX">ASP.NET AJAX</a> framework comes with a lot of baggage err... I mean... a huge learning curve when compared to other <a href="http://en.wikipedia.org/wiki/Ajax_framework">AJAX Frameworks</a> like <a href="http://jquery.com/">JQuery</a>, <a href="http://developer.yahoo.com/yui/">YUI</a>, <a href="http://dojotoolkit.org/">Dojo</a>, <a href="http://www.prototypejs.org/">Prototype</a> / <a href="http://script.aculo.us/">Scriptaculous</a>.</p>
<p> Here&#39;s a running list of the technologies, and concepts you&#39;ll encounter when digging into ASP.NET AJAX:<br /> 
<ul>
<li> ASP.NET<img src="http://adam.kahtava.com/journal/images/blog/ajax_logo.png" style="float: right;"> </li>
<ul>
<li> The Page Life Cycle</li>
<li> The Control Life Cycle</li>
<li> Web Controls</li>
<li> User Controls</li>
<li> View State</li>
<li> Session State</li>
<li> Events </li>
</ul>
<li> .NET / Classical Language </li>
<ul>
<li> Interfaces</li>
<li> Inheritance</li>
<li> Delegates</li>
<li> Multicast Delegates</li>
<li> Assemblies</li>
<li> Properties (Get / Set)</li>
<li> Constructors</li>
</ul>
</ul>
<p> In addition to these, you also have the technologies universal to all JavaScript libraries:<br /> 
<ul>
<li> JavaScript:</li>
<ul>
<li> Closures</li>
<li> Object Literals</li>
<li> JSON</li>
<li> Events</li>
<li> DOM Manipulation</li>
<li> Prototypical Inheritance</li>
<li> Constructors</li>
<li> XMLHttpRequest </li>
</ul>
<li> Cascading Style Sheets (CSS):</li>
<li> Web Services</li>
</ul>
<p> The <a href="http://en.wikipedia.org/wiki/ASP.NET_AJAX">ASP.NET AJAX</a> Framework is more complex than other <a href="http://en.wikipedia.org/wiki/Ajax_framework">AJAX frameworks</a>, I&#39;m continually lost in it&#39;s ambiguity as it attempts to skirt around the JavaScript language - I think this learning curve (and all it&#39;s confusion) is precisely why <a href="http://en.wikipedia.org/wiki/Silverlight">Silverlight</a> has so much potential.  </p>
<p> I&#39;m still diving into the low-level details, but my first impressions of the ASP.NET AJAX Framework are:  <br /> 
<ul>
<li> Obscure, ambiguous, no clear vision - it offers multiple (resource intensive) ways to avoid writing JavaScript, but then requires that you write JavaScript anyways </li>
<li> Too server centric</li>
<li> Too heavy weight (I&#39;m not appreciating how they&#39;re trying to turning JavaScript into a Java, C#, .NET clone, the overhead within the browser for these conversions seems like a huge performance bottleneck)</li>
<li> Has the potential for poor performance  </li>
</ul>
<p> Most of the <u>other</u> AJAX libraries have been written with performance, browser responsiveness, and User Experience as their number one priorities - I&#39;m still not sure about ASP.NET AJAX.  </p>
<p> How many ways can we try to avoid writing JavaScript? If an AJAX library doesn&#39;t enhance the User Experience then why use it? Regardless, I&#39;m still digging deeper.<br /> </p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/04/09/the-aspnet-ajax-learning-curve/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Reflection on Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 (A Final Conclusion)</title>
		<link>http://adam.kahtava.com/journal/2008/04/07/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-a-final-conclusion/</link>
		<comments>http://adam.kahtava.com/journal/2008/04/07/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-a-final-conclusion/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 23:19:54 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,42f9acf9-af59-44fd-aef5-8d3ab773d5ba.aspx</guid>
		<description><![CDATA[A couple years ago I was thrown into a web application that made heavy use of ASP.NET Themes and Skins. Prior to this I depended exclusively on Cascading Style Sheet (CSS) for my web development / web design needs. A first glance at ASP.NET Themes and Skins looked promising, but a number of flaws surfaced [...]]]></description>
			<content:encoded><![CDATA[<p>A couple years ago I was thrown into a web application that made heavy use of ASP.NET Themes and Skins. Prior to this I depended exclusively on Cascading Style Sheet (CSS) for my web development / web design needs. A first glance at ASP.NET Themes and Skins looked promising, but a number of flaws surfaced - see the links and issues listed at the end of this post.</p>
<p>In addition to these issues, here are a couple other considerations when thinking about ASP.NET Themes:</p>
<ul>
<li> Themes do not adequately separate the levels of concerns within your application. When using Themes all design related files are baked into the application. From a maintainability standpoint, this doesn't bode well in large web applications. Hosting design related files on a single server or an external <a href="http://en.wikipedia.org/wiki/Content_Delivery_Network">Content Delivery Network (CDN)</a> is an effective way for managing site wide UI updates and increasing a sites performance, ASP.NET Themes works against this technique.</li>
<li> Themes add unneeded complexity by obscuring the real technologies at work (CSS). Everything that ASP.NET Themes offer can be better achieved outside of the ASP.NET Theme Framework. Technologies like Cascading Style Sheets (CSS),Â  alternate Style Sheets, and JavaScript can achieve more than Themes can provide.</li>
<li> Themes are a server-side mechanism. Themes become a nuisance in client-side dependent, heavily dynamic, Web 2.0, DHTML, AJAX type web applications.</li>
<li> Themes discourage developers from learning more about web design and the technologies surrounding it. Themes offer a seemingly simple API, which shelters developers from the complexities of CSS and JavaScript, but sooner or later <a href="http://www.joelonsoftware.com/articles/LeakyAbstractions.html">The Law of Leaky Abstractions</a> comes into play and knowing the fundamentals of these technologies is a necessity.</li>
<li> Professional web designers don't use ASP.NET Themes, CSS is the language of web designers.</li>
</ul>
<p>Default Skins on the other hand can be useful for defining consistent CSS hooks into common ASP.NET controls. It's unfortunate that we can't use Skins without Themes.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/04/07/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-a-final-conclusion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Book Reviewed: JavaScript: The Definitive Guide by David Flanagan</title>
		<link>http://adam.kahtava.com/journal/2008/03/26/book-reviewed-javascript-the-definitive-guide-by-david-flanagan/</link>
		<comments>http://adam.kahtava.com/journal/2008/03/26/book-reviewed-javascript-the-definitive-guide-by-david-flanagan/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 14:49:27 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[Book]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Programming Languages]]></category>

		<category><![CDATA[Review]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,d293d1fa-0815-4cf5-9e66-494cdddc8e00.aspx</guid>
		<description><![CDATA[  JavaScript: The Definitive Guide by David Flanagan is a great book! When I began reading this book I was convinced that (like many technical books) the first couple chapters would contain the important stuff and the content would slowly digress into page filler, fluff, and the book would become just another monitor stand. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/0596101996?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596101996"><img style="float: right;" src="http://ecx.images-amazon.com/images/I/51OY5KP5ydL._AA240_.jpg" alt="" /></a> <a href="http://www.amazon.com/gp/product/0596101996?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596101996"> JavaScript: The Definitive Guide by David Flanagan</a> is a great book! When I began reading this book I was convinced that (like many technical books) the first couple chapters would contain the important stuff and the content would slowly digress into page filler, fluff, and the book would become just another <a href="http://adam.kahtava.com/journal/2008/03/08/something-about-the-cobblers-children-having-no-shoes/">monitor stand</a>. But not this book! After finishing the formal chapters I started reading the references - YES, this book is so good I'm reading the references! Flanagan has raised the bar for all JavaScript books - this book is in its 5th edition, and has been reviewed by a couple web Gurus (<a href="http://www.crockford.com/">Douglas Crockford</a>, <a href="http://www.quirksmode.org/">Peter-Paul Koch</a>).</p>
<p>JavaScript is the <a href="http://en.wikipedia.org/wiki/Assembly_language">assembly language</a> of the internet - most of the current-generation web frameworks make heavy use of JavaScript, CSS, and AJAX. If you really want to understand how ASP.NET or Ruby on Rails really works, how AJAX works, how JavaScript libraries work. If itching to push the web browser envelope, to really innovate, then this book is a required read. In addition if you're coming from a staticly type background like Java or .NET, then JavaScript (a functional programming language) will open your eyes to a different programming model. <em><strong>Once you grock the fundamentals of JavaScript you'll never be able to look at classical languages (Java, C++, .NET, ...) with a straight face again.</strong></em> I highly recommend this book to any web developer from any web framework camp.</p>
<p>View <a href="http://www.amazon.com/gp/cdp/member-reviews/A2JM0EQJELFL69/">my review</a> on Amazon.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/03/26/book-reviewed-javascript-the-definitive-guide-by-david-flanagan/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Free: Win a Copy of Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages</title>
		<link>http://adam.kahtava.com/journal/2008/02/25/free-win-a-copy-of-professional-aspnet-20-design-css-themes-and-master-pages/</link>
		<comments>http://adam.kahtava.com/journal/2008/02/25/free-win-a-copy-of-professional-aspnet-20-design-css-themes-and-master-pages/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 14:40:51 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Book]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Contest]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,8350b735-2367-413e-87cd-3ce717592130.aspx</guid>
		<description><![CDATA[Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages by Jacob Sanford is a great book for ASP.NET developers looking to expand their knowledge on the ASP.NET 2.0 Web Design front.  
 I&#39;ve read this book, re-read it, edited it, and would like to give it away - I was the Technical Editor. The [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/0470124482?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470124482"><img src="http://ecx.images-amazon.com/images/I/41Rc63UdxTL._AA240_SH20_.jpg" style="border: 0px none ; float: right;"></a><a href="http://www.amazon.com/gp/product/0470124482?ie=UTF8&amp;tag=adamkahtavaap-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0470124482">Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages</a> by Jacob Sanford is a great book for ASP.NET developers looking to expand their knowledge on the ASP.NET 2.0 Web Design front.  </p>
<p> I&#39;ve read this book, re-read it, edited it, and would like to give it away - I was the Technical Editor. The books is like new and (did I mention) it&#39;s free!
<p class="MsoNormal"> <b>Contest Rules:</b>  </p>
<ul>
<li> <font size="4">Updated! Just Leave a comment with a valid email address!</font> </li>
</ul>
<ul>
<li> <strike>Post a 500 x 200 pixel image of something you&#39;re working on in the comments of this post - this image could be code, web design, or anything work related.</strike> </li>
<li> <strike>Include an optional description of your work</strike> </li>
<li> The winner will be chosen <strike>April 1st</strike> May 1st, they&#39;ll be drawn at random, and will be notified through email.</li>
<li> I pay for shipping.</li>
</ul>
<p> <i>* I&#39;ve included a sample entry in the comments. If you&#39;re looking for a great free photo editing application then try <a href="http://www.getpaint.net/">Paint.net</a>. If you&#39;re looking to host your image you might want to consider <a href="http://www.flickr.com/">Flickr</a> or <a href="http://photobucket.com/">Photobucket</a>.</i>  </p>
<p> <strike>Good Luck!</strike> </p>
<p> The contest has ended, and the winner is..... <span class="tx"><b>Andrew Hinde</b>. </span>Nice!<br /> <hints id="hah_hints"> </hints></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/02/25/free-win-a-copy-of-professional-aspnet-20-design-css-themes-and-master-pages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How Well Do You Know JavaScript?</title>
		<link>http://adam.kahtava.com/journal/2008/01/13/how-well-do-you-know-javascript/</link>
		<comments>http://adam.kahtava.com/journal/2008/01/13/how-well-do-you-know-javascript/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 19:09:19 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[IE]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Software]]></category>

		<category><![CDATA[Videos]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,b8b02f0d-1ed8-445a-a698-28458ef98622.aspx</guid>
		<description><![CDATA[
JavaScript is probably the world's most popular and misunderstood programming languages and for good reason.
When a developer claims to know JavaScript this generally equates to one or all of the following:

 "I know what JavaScript is, I can learn JavaScript in 30 minutes"
 "JavaScript is for kids, it's a toy language, it's easy"
 "I just [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; padding-left: 5px;"><a href="http://www.flickr.com/photos/matthiasorfield/368716706/"><img src="http://farm1.static.flickr.com/98/368716706_d8c474a12c_m.jpg" alt="" /></a></div>
<p>JavaScript is probably the world's most popular and misunderstood programming languages and for good reason.<br />
When a developer claims to <em>know</em> JavaScript this generally equates to one or all of the following:</p>
<ul>
<li> <em>"I know what JavaScript is, </em><em>I can learn JavaScript in 30 minutes</em><em>"</em></li>
<li> <em>"JavaScript is for kids, it's a toy language, it's easy"</em></li>
<li> <em>"I just copy and paste my JavaScript snippets / scripts from the internet"</em></li>
<li> <em>"JavaScript is just another programming language like C++, C#, VB.NET, or Java"</em></li>
</ul>
<p>If thoughts similar to these have crossed your mind when sizing up your JavaScript knowledge, then you probably don't know JavaScript.</p>
<p>I would argue that if you've never programmed in a <a href="http://en.wikipedia.org/wiki/Functional_programming">functional programming language</a> (like: <a href="http://en.wikipedia.org/wiki/LISP">Lisp</a>, <a href="http://en.wikipedia.org/wiki/Scheme">Scheme</a>, <a href="http://en.wikipedia.org/wiki/F_Sharp_programming_language">F#</a>), never read a <a href="http://adam.kahtava.com/journal/2008/04/16/how-to-choose-a-good-technical-book/"><strong><span style="text-decoration: underline;"><em>GOOD</em></span></strong></a> book on JavaScript, or never watched a video on JavaScript, then you probably don't understand JavaScript at all. JavaScript is starkly different than any other mainstream programming language.</p>
<p>When it comes to JavaScript, if you don't understand the fundamentals then you're only punishing yourself.</p>
<p><strong>Here are some things every JavaScript developer should probably understand:</strong></p>
<ul>
<li> <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a>, <a href="http://en.wikipedia.org/wiki/JavaScript#History_and_naming">Mocha</a>, <a href="http://en.wikipedia.org/wiki/Livescript">LiveScript</a>, <a href="http://en.wikipedia.org/wiki/JScript">JScript</a>, and <a href="http://en.wikipedia.org/wiki/ECMAScript">ECMAScript</a> are all essentially the same.</li>
<li> JavaScript is a prototypically inherited (<a href="http://en.wikipedia.org/wiki/Prototype-based_programming">prototype-based programming</a>) language which is very different than the classically inherited (<a href="http://en.wikipedia.org/wiki/Class-based_programming">class-based programming</a>) languages like C++, Java, and most of the .NET languages - you know the difference between a prototype-based programming and class-based programming language.</li>
<li> JavaScript is a loosely typed language - you know the difference between <a href="http://en.wikipedia.org/wiki/Strongly-typed_programming_language">strongly-typed programming</a> languages and <a href="http://en.wikipedia.org/wiki/Weak_typing">weak-typed</a> or loosely typed languages.</li>
<li> JavaScript is a functional <a href="http://en.wikipedia.org/wiki/Lambda_calculus">lambda</a> language - you understand lambdas and that functions in JavaScript can be lambdas.</li>
<li> JavaScript functions can be defined inside functions, inside functions, inside functions, and so on - you can demonstrate this.</li>
<li> JavaScript uses function scope, has no curly brace <em>'{}'</em> block scope - you understand that this is common attribute of most functional programming languages.</li>
<li> JavaScript has no private, public, protected assessors, no classes, no enums, no structs - you understand that all these language features can be achieved through objects and function closures.</li>
<li> JavaScript is classless, but instead it uses objects as general containers.</li>
<li> JavaScript makes use of garbage collection.</li>
<li> JavaScript uses truthy and falsy values - you understand which values are truth and falsy.</li>
<li> JavaScript makes use of the <em>'nan'</em> (not a number) and <em>'undefined'</em> values - you understand the difference between these values.</li>
<li> JavaScript has pretty good debuggers - you understand how to debug JavaScript from both IE (<a href="http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html">link</a>) and Firefox (<a href="http://www.getfirebug.com/js.html">link</a>).</li>
<li> You appreciate recursion, and understand that recursion is a useful technique in JavaScript.</li>
<li> You understand that JavaScript Namespaces should be used - you understand the importance of namespaces, and know how to create one (<a href="http://adam.kahtava.com/journal/2008/03/17/namespacing-your-javascript/">Namespacing Your JavaScript</a>).</li>
<li> You know how to avoid the <a href="http://www.dynamicsitesolutions.com/javascript/mistakes/">JavaScript pseudo-protocol</a> (<em>&lt;a href="Javascript:alert('hello');"</em>), and appreciate avoiding it.</li>
<li> You know how to avoid embedding DOM Level 0 JavaScript events (<em>&lt;a onclick=''alert('hello');"</em>) in your mark-up / document structure, and appreciate this technique.</li>
<li> You know that JavaScript can make use of two different event models (<a href="http://www.quirksmode.org/js/events_order.html">event capturing and bubbling</a>), but we should only ever make use of bubbling.</li>
<li> You understand what <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> is and how it's used.</li>
<li> You know how to keep you JavaScript, CSS, document structure separate, and appreciate non obtrusive JavaScript.</li>
</ul>
<p>If any of these points seem foreign, then it may be time to learn JavaScript. With all the hype and buzz around Web 2.0 and AJAX it could be a great way to augment your career while broadening your programming language vocabulary.</p>
<p><strong>Great resources for learning more about JavaScript:</strong></p>
<p>Videos:</p>
<ul>
<li> <em>The JavaScript Programming Language</em>: <a href="http://video.yahoo.com/video/play?vid=111593">Part 1</a>, <a href="http://video.yahoo.com/video/play?vid=111594">Part 2</a>, <a href="http://video.yahoo.com/video/play?vid=111595">Part 3</a>, <a href="http://video.yahoo.com/video/play?vid=111596">Part 4</a></li>
<li> <em>An Inconvenient API: The Theory of the DOM</em>: <a href="http://video.yahoo.com/video/play?vid=111582">Part 1</a>, <a href="http://video.yahoo.com/video/play?vid=111583">Part 2</a>, <a href="http://video.yahoo.com/video/play?vid=111584">Part 3</a></li>
<li> <em>Advanced JavaScript:</em> <a href="http://video.yahoo.com/video/play?vid=111585">Part 1</a>, <a href="http://video.yahoo.com/video/play?vid=111586">Part 2</a>, <a href="http://video.yahoo.com/video/play?vid=111587">Part 3</a></li>
<li> <em>JavaScript: The Good Stuff</em>: <a href="http://video.yahoo.com/video/play?vid=630959">Link</a></li>
<li> All these videos are available on the <a href="http://developer.yahoo.com/yui/theater/">YUI Theater</a> - all the videos are great, watch them all!</li>
</ul>
<p>Books:</p>
<ul>
<li> <a href="http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/1565923928/?tag=adamkahtavaap-20&amp;creativeASIN=1565923928">JavaScript: The Definitive Guide by David Flanagan</a></li>
<li> <a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742?tag=adamkahtavaap-20&amp;creativeASIN=0596517742">JavaScript: The Good Parts by Douglas Crockford</a></li>
</ul>
<p>Links:</p>
<ul>
<li> <a href="http://developer.mozilla.org/en/docs/A_re-introduction_to_JavaScript">MDC: A re-introduction to JavaScript</a></li>
<li> <a href="http://javascript.crockford.com/code.html">Code Conventions for the JavaScript Programming Language</a></li>
<li> <a href="http://javascript.crockford.com/javascript.html">JavaScript: The World's Most Misunderstood Programming Language</a></li>
<li> <a href="http://www.odetocode.com/Articles/473.aspx">What ASP.NET Developers Should Know About JavaScript</a></li>
<li> <a href="http://thinkingandmaking.com/entries/63">Best Practices: Implementing JavaScript for rich internet applications</a></li>
<li> <a href="http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/">The seven rules of Unobtrusive JavaScript</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2008/01/13/how-well-do-you-know-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My first Greasemonkey Script: Goodbye ASP.NET Forum Ads</title>
		<link>http://adam.kahtava.com/journal/2007/11/21/my-first-greasemonkey-script-goodbye-aspnet-forum-ads/</link>
		<comments>http://adam.kahtava.com/journal/2007/11/21/my-first-greasemonkey-script-goodbye-aspnet-forum-ads/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 03:12:58 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Firebug]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,e81cbb41-be44-4c48-ac58-1b88c42bb95a.aspx</guid>
		<description><![CDATA[Greasemonkey is an add-on for Firefox. Through JavaScript it allows anyone the ability to dynamically modify a page as, or after it's being rendered in the browser. This lets anyone trim the DOM, remove ads, and modify page in anyway they see fit (it also opens up some serious privacy concerns with XSS). Anyhow, I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Greasemonkey">Greasemonkey</a> is an add-on for Firefox. Through JavaScript it allows anyone the ability to dynamically modify a page as, or after it's being rendered in the browser. This lets anyone trim the DOM, remove ads, and modify page in anyway they see fit (it also opens up some serious privacy concerns with <a href="http://en.wikipedia.org/wiki/Cross_site_scripting">XSS</a>). Anyhow, I spend a fair time on the <a href="http://forums.asp.net/139.aspx">ASP.NET forums</a>, but the advertisements have always made for a somewhat negative, but tolerable user experience.</p>
<p>Today I finally broke down and wrote my own Greasemonkey script - now formally known as <em>"The ASP.NET Forums Beautifier"</em> for lack of a better name.</p>
<p><strong>The Script Before and After: </strong></p>
<p><strong>Before - </strong>usually the ASP.NET Forums look like this:<br />
<img src="http://adam.kahtava.com/etcetera/greasemonkey/gm.forums.asp.net.before.small.png" alt="" /></p>
<p><strong>After</strong> - with my script running in Greasemonkey we get this:<br />
<img src="http://adam.kahtava.com/etcetera/greasemonkey/gm.forums.asp.net.after.small.png" alt="" /></p>
<p><em>note: the greasemonkey icon, and complete lack of fluff / advertisements on the second screenshot.</em></p>
<p>Creating this script was simpler than I expected. It was a matter of skimming through an article on <a href="http://www.cyberciti.biz/tips/how-to-write-greasemonkey-scripts.html">How to write Greasemonkey scripts</a>, using <a href="http://www.getfirebug.com/logging.html">Firebug's JavaScript Console</a> and <a href="http://developer.mozilla.org/en/docs/JavaScript_Console">Firefox's Error Console</a> to test my code (after all, Firefox is the new IDE, <a href="http://www.codinghorror.com/blog/archives/000780.html">Firefox as an IDE</a>), and an hour later, Viola! No more ads.</p>
<p>The <a href="http://yuiblog.com/">YUI blog</a> and <a href="http://adam.kahtava.com/journal/2007/09/16/javascript-is-awesome-i-want-to-work-with-douglas-crockford/">Douglas Crockford</a> in particular, have inspired my JavaScript renaissance. JavaScript is really interesting, it's a functional, loosely typed programming language that uses <a href="http://en.wikipedia.org/wiki/Prototype-based_programming">prototype-base inheritance</a>. Developing in JavaScript is a real treat from some of the more statically typed languages.</p>
<p>Download <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a> and <em><a href="http://userscripts.org/scripts/show/25869">"The ASP.NET Forums Beautifier"</a></em> for yourself. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/11/21/my-first-greasemonkey-script-goodbye-aspnet-forum-ads/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</title>
		<link>http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/</link>
		<comments>http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 00:49:15 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,cccb1beb-f995-47ca-92ba-137b7d73f082.aspx</guid>
		<description><![CDATA[ASP.NET 2.0 Themes have a couple design flaws, all of which center around the way Themes reference Cascading Style Sheets (CSS). I've been posting Theme and CSS related issues and work arounds as I encountered them, and in one of my first posts I outlined the possibility of using a VirtualPathProvider to ignore the CSS [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0 Themes have a couple design flaws, all of which center around the way Themes reference <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">Cascading Style Sheets (CSS)</a>. I've been posting Theme and CSS related issues and work arounds as I encountered them, and in one of my first posts I outlined the possibility of using a <a href="http://msdn2.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx">VirtualPathProvider</a> to ignore the CSS files within a directory. In this post I share <a href="http://www.linkedin.com/pub/3/703/412">David Marzo's</a> implemented of this solution. This resolution resolves most of the issues surrounding Themes and CSS, and essentially puts the Cascades back into CSS.</p>
<p><strong>The Problem / Question:</strong><br />
ASP.NET 2.0 Themes automatically includes all the Style Sheets (.css files) found in the active Theme (App_Theme) directory into the Head of the rendered document. This severely limits the robust CSS language, and works against the last decade of Cascading Style Sheet progress. For more specific details on the problems with ASP.NET 2.0 Themes start reading the articles found <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">here</a>.</p>
<p><strong>A Solution / Work Around: </strong><br />
Add a custom <a href="http://msdn2.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx">VirtualPathProvider</a> to ignore the Style Sheets (CSS files) found in the App_Theme directory. For more background on this solution see <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">my article</a> and David Ebbo's article titled <a href="http://blogs.msdn.com/davidebb/archive/2005/11/27/overriding-asp-net-combine-behavior-using-a-virtualpathprovider.aspx"> Overriding ASP.NET combine behavior using a VirtualPathProvider</a>.</p>
<p><strong>An example of the problem:</strong></p>
<p><strong></strong><strong>The directory structure:</strong><br />
<strong><img src="http://adam.kahtava.com/journal/images/blog/TPWSAT_Resolution.png" alt="" /></strong><br />
<em>Notice all the Style Sheets (.css files), there are more in the Adapters directory too.</em></p>
<p><strong><span style="text-decoration: underline;">Before</span> including the CustomVirtualPathProvider (code provided below) into the project's build - the XHTML rendered by Themes:</strong></p>
<pre><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"</span> <span style="color: blue;">&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">  &lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">title</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">The Problems With Themes and Skins in ASP.NET 2.0</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">title</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">    &lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">link</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/CSS/Adapters/ChangePassword.css"</span> <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt; </span></span>

<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;">    ... The other 17 externally linked Style Sheets go here, they were removed to improve readability ...</span></span>

<span style="color: #008000;"> </span><span style="color: #008000;">    </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">link</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/CSS/PrinterFriendly.css"</span> <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">  &lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></pre>
<p><em>The Style Sheets are automagically inserted into the Head tag from the active Theme directory. Keep in mind that Internet Explorer has a 30 Style Sheet limitation (see article <a href="http://support.microsoft.com/kb/q262161">Q262161</a>).</em><br />
<strong></strong></p>
<p><strong><span style="text-decoration: underline;">After</span> including the CustomVirtualPathProvider (code provided below) into the project's build - the XHTML rendered by Themes:</strong></p>
<pre><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"</span> <span style="color: blue;">&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">  &lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">title</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">The Problems With Themes and Skins in ASP.NET 2.0</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">title</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">  &lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></pre>
<p><em>Notice the complete lack of Style Sheets - ahhh simplicity is bliss, the very foundations of <a href="http://www.csszengarden.com/">CSS Zen Enlightenment</a>... :) Now we can manually include our Style Sheets, use Conditional Comments, and so on.<br />
</em></p>
<p><strong>The source code for the CustomVirtualPathProvider provided by <a href="http://www.linkedin.com/pub/3/703/412">David Marzo</a> in C#:<br />
</strong></p>
<pre><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">namespace</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> Arfila.Web.Logic {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>[<span style="color: teal;">AspNetHostingPermission</span>(<span style="color: teal;">SecurityAction</span>.Demand,
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Level = <span style="color: teal;">AspNetHostingPermissionLevel</span>.Medium)]</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>[<span style="color: teal;">AspNetHostingPermission</span>(<span style="color: teal;">SecurityAction</span>.InheritanceDemand,
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Level = <span style="color: teal;">AspNetHostingPermissionLevel</span>.High)]</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: teal;">CustomVirtualPathProvider</span> : <span style="color: teal;">VirtualPathProvider</span> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> AppInitialize() {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: teal;">HostingEnvironment</span>.RegisterVirtualPathProvider(<span style="color: blue;">new</span> <span style="color: teal;">CustomVirtualPathProvider</span>());</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">public</span> CustomVirtualPathProvider() : <span style="color: blue;">base</span>() { }</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">private</span> <span style="color: blue;">bool</span> IsThemeDirectory(<span style="color: blue;">string</span> virtualPath) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span>    </span><span style="color: teal;">String</span> checkPath = <span style="color: teal;">VirtualPathUtility</span>.ToAppRelative(virtualPath);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: blue;">return</span> checkPath.StartsWith(<span style="color: maroon;">"~/App_Themes/"</span>, <span style="color: teal;">
</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">StringComparison</span>.InvariantCultureIgnoreCase);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span><span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: teal;">VirtualDirectory</span> GetDirectory(<span style="color: blue;">string</span> virtualDir) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: blue;">if</span> (IsThemeDirectory(virtualDir)) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>       </span><span style="color: blue;">return</span> <span style="color: blue;">new</span> <span style="color: teal;">ThemeDirectory</span>(Previous.GetDirectory(virtualDir));</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span><span style="color: blue;">else</span> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>       </span><span style="color: blue;">return</span> Previous.GetDirectory(virtualDir);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>     </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>   </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>[<span style="color: teal;">AspNetHostingPermission</span>(<span style="color: teal;">SecurityAction</span>.Demand,
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Level = <span style="color: teal;">AspNetHostingPermissionLevel</span>.Minimal)]</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>[<span style="color: teal;">AspNetHostingPermission</span>(<span style="color: teal;">SecurityAction</span>.InheritanceDemand,
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Level = <span style="color: teal;">AspNetHostingPermissionLevel</span>.Minimal)]</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: teal;">ThemeDirectory</span> : <span style="color: teal;">VirtualDirectory</span> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: teal;">VirtualDirectory</span> _toFilter;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">private</span> <span style="color: teal;">ArrayList</span> _children = <span style="color: blue;">new</span> <span style="color: teal;">ArrayList</span>();</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">private</span> <span style="color: teal;">ArrayList</span> _directories = <span style="color: blue;">new</span> <span style="color: teal;">ArrayList</span>();</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">private</span> <span style="color: teal;">ArrayList</span> _files = <span style="color: blue;">new</span> <span style="color: teal;">ArrayList</span>();</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: teal;">IEnumerable</span> Children {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">get</span> { <span style="color: blue;">return</span> _children; }</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: teal;">IEnumerable</span> Directories {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">get</span> { <span style="color: blue;">return</span> _directories; }</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: teal;">IEnumerable</span> Files {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">get</span> { <span style="color: blue;">return</span> _files; }</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">public</span> ThemeDirectory(<span style="color: teal;">VirtualDirectory</span> toFilter) : <span style="color: blue;">base</span>(toFilter.VirtualPath) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span>_toFilter = toFilter;</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span>BuildChild();</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span><span style="color: blue;">private</span> <span style="color: blue;">void</span> BuildChild() {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">foreach</span> (<span style="color: teal;">VirtualDirectory</span> dirToFilter <span style="color: blue;">in</span> _toFilter.Directories) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span><span style="color: teal;">ThemeDirectory</span> themeDir = <span style="color: blue;">new</span> <span style="color: teal;">ThemeDirectory</span>(dirToFilter);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span>_children.Add(themeDir);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span>_directories.Add(themeDir);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span><span style="color: blue;">foreach</span> (<span style="color: teal;">VirtualFile</span> fileToFilter <span style="color: blue;">in</span> _toFilter.Files) {
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span><span style="color: blue;">string</span> fileExtension = </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: teal;">VirtualPathUtility</span>.GetExtension(fileToFilter.VirtualPath).TrimStart(<span style="color: maroon;">'.'</span>);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span><span>      </span><span style="color: blue;">if</span> (<span style="color: blue;">string</span>.Compare(</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">fileExtension</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">, <span style="color: maroon;">"css"</span>, <span style="color: blue;">true</span>) != 0) {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>          </span>_children.Add(fileToFilter);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>          </span>_files.Add(fileToFilter);</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span><span style="color: blue;">else</span> {</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>          </span><span style="color: green;">//archivo .css no incluir</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>        </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>      </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>    </span>}</span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>  </span>}
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span></pre>
<p><em>Some of the code has been modified for readability, download the original source code <a href="http://adamdotcom-script.googlecode.com/svn/trunk/Etcetera/CustomVirtualPathProvider.cs">here</a>.</em></p>
<p><strong>Note:</strong><em> In order to use this VPP you'll have to copy the code above into a new class in your App_Code directory.</em></p>
<div style="border: 1px solid #ccccee; padding: 5px; background-color: #ffffdd;"><strong>Caveat: </strong><em>If a Web site is precompiled for deployment, content provided by a VirtualPathProvider instance is not compiled, and no VirtualPathProvider instances are used by the precompiled site.</em> - Taken from the article titled <a href="http://msdn2.microsoft.com/en-us/library/system.web.hosting.virtualpathprovider.aspx">VirtualPathProvider Class</a> on MSDN.</div>
<p><strong><br />
Conclusion:</strong> This is one of the nicest work arounds or resolution to the issues surrounding ASP.NET 2.0 Themes. It allows us to leverage the power of ASP.NET 2.0 default Skins, allows us to logically group design related resources (Style Sheets, images, default Skins, videos, etc...) in the App_Theme directory, allows us to control the loading order (cascades) of style sheets, allows us to use <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">Conditional Comments</a>, to define <a href="http://www.w3.org/TR/REC-CSS2/media.html">Media Types</a>, to override / inherit Styles, and to continue using CSS as it's intended. In addition we can now easily integrate the <a href="http://www.asp.net/cssadapters/">ASP.NET 2.0 CSS Friendly Control Adapters</a> into our web applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/feed/</wfw:commentRss>
		</item>
		<item>
		<title>In Favor of Using Style Elements / Embedded Style Sheets / Style Blocks / Style Tags or Whatever You Want To Call Them inside the HTML / XHTML Body.</title>
		<link>http://adam.kahtava.com/journal/2007/03/20/in-favor-of-using-style-elements-embedded-style-sheets-style-blocks-style-tags-or-whatever-you-want-to-call-them-inside-the-html-xhtml-body/</link>
		<comments>http://adam.kahtava.com/journal/2007/03/20/in-favor-of-using-style-elements-embedded-style-sheets-style-blocks-style-tags-or-whatever-you-want-to-call-them-inside-the-html-xhtml-body/#comments</comments>
		<pubDate>Tue, 20 Mar 2007 22:20:02 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Firebug]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[IE]]></category>

		<category><![CDATA[Opera]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,fb97f8d5-0271-466f-a3f3-e09c53890ab0.aspx</guid>
		<description><![CDATA[I've been using Style Elements within the HTML Body tag to work around some of the design flaws presented in ASP.NET 2.0 Themes - see the second solution in this post for more details. I've been leary of using this method because it's not a best practice, since it compromises the validity of the HTML [...]]]></description>
			<content:encoded><![CDATA[<p>I've been using <a href="http://www.w3.org/TR/REC-CSS1#containment-in-html">Style Elements</a> within the HTML Body tag to work around some of the design flaws presented in ASP.NET 2.0 Themes - see the second solution in <a href="http://adam.kahtava.com/journal/c1575144-e460-464d-b993-259ce96135f4.aspx">this post</a> for more details. I've been leary of using this method because it's not a best practice, since it compromises the validity of the HTML / XHTML document. I decided to do a little more research on this subject and made the following discoveries.</p>
<p><strong>Discoveries:</strong></p>
<ol>
<li> Some of the more complex web sites (<a href="http://amazon.com/">Amazon</a> and <a href="http://www.yahoo.com/">Yahoo!</a>) make use of Style Elements within the Body Element - see the source snippets below.</li>
<li> <a href="http://en.wikipedia.org/wiki/Gecko_%28layout_engine%29">Gecko</a> (<a href="http://en.wikipedia.org/wiki/Firefox">Firefox</a>, <a href="http://en.wikipedia.org/wiki/Flock_%28web_browser%29">Flock</a>, <a href="http://en.wikipedia.org/wiki/Mozilla">Mozilla</a>, etc...) based browsers automatically move Style Elements found within the Body Element into the Head Element and render the page as expected - see the rendered Document Object Model (DOM) image below.</li>
<li> <a href="http://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer</a> doesn't move the Style Element into the Head Element, but renders the page as expected.</li>
<li> <a href="http://en.wikipedia.org/wiki/Opera_%28internet_suite%29">Opera</a>... well I wish I knew what Opera did, but the page renders as expected.</li>
</ol>
<p><strong>Source snippet from Amazon:</strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><br />
</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">table</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>Â Â Â  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">td</span><span style="color: blue;">&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>Â  </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">tr</span><span style="color: blue;">&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">table</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;Â </p>
<p><strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">type</span><span style="color: blue;">="text/css"&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">.lol-hr-center</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> { <span style="color: red;">margin</span>: <span style="color: blue;">5px</span>; <span style="color: red;">border-top-width</span>: <span style="color: blue;">1px</span>; </span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">/* and so on... */</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></strong></p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">div</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">id</span><span style="color: blue;">="listoflists_data"</span> <span style="color: red;">style</span><span style="color: blue;">="display:none"&gt; </span></span><br />
<em>Note how the Style element is located between the &lt;table&gt; and &lt;div&gt; tags.</em></p>
<p></span><br />
<strong>Source snippet from Yahoo!:</strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">h4</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">a</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">id</span><span style="color: blue;">="paweather"</span> <span style="color: red;">class</span><span style="color: blue;">="details"</span> <span style="color: red;">href</span><span style="color: blue;">="r/wb/*-http://weather.yahoo.com/forecast/USKS0448_f.html"&gt;&lt;</span><span style="color: maroon;">span</span> <span style="color: red;">class</span><span style="color: blue;">="icon"&gt;</span>Weather <span style="color: blue;">&lt;</span><span style="color: maroon;">b</span><span style="color: blue;">&gt;&lt;</span><span style="color: maroon;">strong</span><span style="color: blue;">&gt;</span>51<span style="color: red;">&amp;deg;</span><span style="color: blue;">&lt;/</span><span style="color: maroon;">strong</span><span style="color: blue;">&gt;</span>F<span style="color: blue;">&lt;/</span><span style="color: maroon;">b</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">span</span><span style="color: blue;">&gt;&lt;/</span><span style="color: maroon;">a</span><span style="color: blue;">&gt;</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong>&lt;</strong></span><strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span></strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong> <span style="color: red;">type</span><span style="color: blue;">="text/css"&gt;</span><span style="color: maroon;">#patabs</span> <span style="color: maroon;">#weather</span> <span style="color: maroon;">.icon</span>{<span style="color: red;">background</span>:<span style="color: blue;">url(http://us.i1.yimg.com/us.yimg.com/i/us/we/31/b/26.gif)</span> <span style="color: blue;">3px</span> <span style="color: blue;">2px</span><span style="color: blue;">no-repeat</span>;}<span style="color: blue;">&lt;/</span><span style="color: maroon;">style</span><span style="color: blue;">&gt;</span></strong></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong></strong>&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">h4</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<em>Note how the Style element is located within the &lt;h4&gt; tag.</em><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> </span><br />
<strong>A snapshot of the <a href="http://en.wikipedia.org/wiki/Document_Object_Model">Document Object Model (DOM)</a> as seen through <a href="http://www.getfirebug.com/">Firebug</a>:</strong></p>
<blockquote><p><img src="http://adam.kahtava.com/journal/images/blog/StyleInBody1.png" alt="" /><br />
<em>Note the highlighted area references the Yahoo! source snippet from above.</em>Â<br />
<strong>Conclusion:</strong> Although the Style Element within the Body Element compromises the validity of a document, some of the leaders in web design and accessibility use this approach, so it may not be as big a work around or hack.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/03/20/in-favor-of-using-style-elements-embedded-style-sheets-style-blocks-style-tags-or-whatever-you-want-to-call-them-inside-the-html-xhtml-body/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 - Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</title>
		<link>http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/</link>
		<comments>http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 15:19:12 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,002ae3f5-6496-4d64-aab8-d3ccf498d7c7.aspx</guid>
		<description><![CDATA[In this post I outline a couple alternate ways of defining the CSS Print Media Type with Themes. ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Style Sheets (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I outline a couple alternate ways of defining the CSS Print <a href="http://www.w3.org/TR/REC-CSS2/media.html">Media Type</a> with Themes. ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on <a href="http://en.wikipedia.org/wiki/Css">Cascading Style Sheets (CSS)</a>, but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your application is even developed, instead I suggest sticking with CSS and perhaps using some default Skins that define CSS selectors like classes or IDs.</p>
<p><strong>The Problem / Question:</strong><br />
How can I use the CSS Print <a href="http://www.w3.org/TR/REC-CSS2/media.html">Media Type</a> with Themes? In the past I've used an <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.1">External Style Sheet</a> which defined the Print Media Type, but ASP.NET 2.0 omits the Media Type attribute when it automatically includes all my CSS files (from the active Theme directory) into the HTML Head tag.</p>
<p><strong>A Solution / Work Around:</strong><br />
The Print Media Type isn't constrained to External Style Sheets and can be defined in the <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.3">Style Element</a>, in the <a href="http://www.w3.org/TR/CSS21/media.html#at-media-rule">@Media rule</a>, and even specified through the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">@Import rule</a>.</p>
<p><strong>An example of the problem:</strong></p>
<p><strong></strong><strong>The directory structure:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_5_VS05_SS1.png" alt="" /></p>
<p><strong>The rendered XHTML: </strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0<span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>=<span style="color: #0000ff;">"App_Themes/Default/PrinterFriendlyStyleSheet.css"</span></span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>=<span style="color: #0000ff;">"App_Themes/Default/StyleSheet.css"</span></span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<em>Note each externally linked Style Sheet lacks a media type.</em></p>
<p><strong>Our desired XHTML (using an Externally Linked Style Sheet and a Print Media Type) would have looked something like this: </strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>=<span style="color: #0000ff;">"App_Themes/Default/PrinterFriendlyStyleSheet.css"</span></span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: red;">media</span><span style="color: blue;">="all"</span><strong><span style="color: blue;"> </span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span>/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/PrinterFriendlyStyleSheet.css"</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <strong><span style="color: red;">media</span><span style="color: blue;">="print"</span></strong> <span>/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<em>Note the Media Type (<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong><span style="color: red;">media</span><span style="color: blue;">="print"</span></strong></span>) in bold.</em></p>
<p><strong> The solutions:</strong></p>
<p><strong></strong><strong>Option 1. </strong>Use the <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">Media Rule (@Media)</a> to define the print <a href="http://www.w3.org/TR/REC-CSS2/media.html#media-types">Media Type</a> inside an <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3">Externally Linked</a> Style Sheet.</p>
<p><strong>An example:</strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@Media</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> Print {</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: maroon;">body</span> {</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">background-color</span>: <span style="color: blue;">#FFFFFF</span>;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>}</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: green;">/*... your CSS here ...*/</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: maroon;">#Menu</span>, <span style="color: maroon;">#AdvertismentContainer</span> {</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">display</span>: <span style="color: blue;">none</span>;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>}</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: maroon;">#Content</span> {</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">width</span>: <span style="color: blue;">100%</span>;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span>}</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">}</span><br />
<strong>Discussion:</strong> This is probably the best alternative to defining the Media Type in an Externally Linked Style Sheet - the other solutions introduce problems of their own.<br />
<strong></strong></p>
<p><strong>Option 2. </strong>Use the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">Import Rule (@Import)</a> to load your printer friendly Style Sheet from an alternate location and define a <a href="http://www.w3.org/TR/REC-CSS2/media.html#media-types">Media Type</a> - this involves removing your printer friendly Style Sheet from the Themes (App_Theme directory).</p>
<p><strong>An example:</strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@Import</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> url("/AppName/CSS/PrinterFriendlyStyleSheet.css") Print;</span></p>
<p><strong>Discussion:</strong> This solution requires moving our Printer Friendly Style Sheet outside the Theme directory, since Themes don't allow us to exclude a Style Sheet folder (see <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder</a> for more details). Once we start moving Style Sheets outside the Themes directory we should probably ask ourselves why we're even using Themes, and consider regaining complete control over our CSS by moving all the CSS files outside the Theme directory. At this point we could revert to Externally Linking our Style Sheets where we could define our Media Type attributes. In addition the CSS <a href="http://www.w3.org/TR/REC-CSS1#url">URL function</a> used in this solution confuses many.<br />
<strong></strong></p>
<p><strong>Option 3. </strong>Use the <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.3">Style Element</a> to define a Print <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.4">Media Type</a>.</p>
<p><strong>An example:</strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">media</span><span>=<span style="color: #0000ff;">"print"</span>&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: green;">/*... your CSS here ...*/</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span>&gt;</p>
<p><strong>Discussion:</strong> This solution doesn't work if the <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.3">Style Elements</a> are defined in the HTML head (see <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style Sheets with Themes</a> for more details), you can however move the Style Element into the Body of the document, this compromises the HTML validation, but large e-commerce sites like <a href="http://amazon.com/">Amazon</a> and <a href="http://www.yahoo.com/">Yahoo!</a> make heavy use of this method.</p>
<p><strong>Option 4. </strong>Sub class the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlhead_members.aspx">HtmlHead class</a> to enumerate through the child controls and add new Meta attributes to the child controls using the <a href="http://msdn2.microsoft.com/en-US/library/system.web.ui.htmlcontrols.htmllink_properties.aspx">HtmlLink class</a>. See my post titled <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s)</a> for more details.<br />
<strong>Discussion:</strong> This solution requires a fair amount of work and only solves one of the many problems with Themes, pursuing this solution would probably be a case of <a href="http://www.answers.com/topic/can-t-see-the-forest-for-the-trees">not seeing the forest for the trees</a>.</p>
<p><strong>In conclusion;</strong> Themes are a nice addition to ASP.NET, but have some significant design flaws particularly in the way it uses CSS - in this case how printer friendly (print) CSS Media Types are defined. I wouldn't recommend using Themes on a complex web applications that make heavy use of CSS or AJAX, but for small projects they may be a nice option.</p>
<p><strong>Related links:</strong></p>
<ul>
<li> <a href="http://alistapart.com/articles/goingtoprint/">CSS Design: Going to Print</a></li>
<li> <a href="http://alistapart.com/articles/boom">Printing a Book with CSS: Boom!</a></li>
<li> <a href="http://www.tufts.edu/webcentral/tutorials/printcss/">A Print CSS Primer</a></li>
<li> <a href="http://webdesign.about.com/cs/css/a/aa042103a.htm">CSS Media Types Create Print-Friendly Pages</a></li>
</ul>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 - Using Internal (Embedded) Style Sheets with Themes (Work Around #4)</title>
		<link>http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/</link>
		<comments>http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 18:44:36 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,c1575144-e460-464d-b993-259ce96135f4.aspx</guid>
		<description><![CDATA[ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Stye Sheet (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on <a href="http://en.wikipedia.org/wiki/Css">Cascading Stye Sheet (CSS)</a>, but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your application is even developed, instead I suggest sticking with CSS and perhaps using some default Skins that define CSS selectors like classes or IDs.</p>
<p><strong>The Problem / Question:</strong><br />
How can I add Internal (embedded) style sheets (the ones that use the <a href="http://www.w3.org/TR/2004/WD-xhtml2-20040722/mod-styleSheet.html#sec_25.1.">Style element)</a> inside the Head tag when using Master Pages and Themes?Â  How can I override (overload) <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3">External style sheets</a> for local pages or specific Web User Controls?</p>
<p><strong>A Solution / Work Around:</strong></p>
<p>One option is to create an ASP Placeholder (<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">asp</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">:</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">contentplaceholder</span>) in the Master Page's Head tag to add the Style element into the Head of your Web Form (.aspx page). However, this solution doesn't work well when using Themes, since themes automatically include the External style sheets after the Style element - I demonstrate this and provide an alternative solution later on in this post.</p>
<p><strong>The Caveat / Warnings:</strong><br />
In most current-generation browsers the loading order for Internal style sheets, and External style sheets depend on their position in the Head tag. This behavior seems to go against what the W3C intended.</p>
<blockquote><p><em>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:<br />
</em></p>
<ol>
<li> <em>Browser default</em></li>
<li> <em>External style sheet</em></li>
<li> <em>Internal style sheet (inside the &lt;head&gt; tag)</em></li>
<li> <em>Inline style (inside an HTML element)</em></li>
</ol>
<p><em>- Taken from: <a href="http://www.w3schools.com/css/css_intro.asp">http://www.w3schools.com/css/css_intro.asp</a></em></p></blockquote>
<p>As I understand and as the w3schools point out (I can't find a reference from the depths of the <a href="http://www.w3.org/Style/CSS/">W3C</a>), Internal style sheets should have a higher priority than External style sheets, unfortunately this isn't the reality. Instead External style sheets and Internal style sheets depend on the loading (cascading) order. An Internal style sheet will only override an External style sheet (in current-generation browsers) if the External style sheet is loaded first. This behavior introduces problems when using an ASP Placeholder because ASP.NET automatically includes the Style Sheets (.css) from the active Theme (App_Theme) directories into the Head tag after the ASP Placeholder's contents have been loaded.</p>
<p><strong>An example of the problem:</strong></p>
<p><strong>The directory structure:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_4_VS05_SS1.png" alt="" /></p>
<p class="MsoNormal"><strong>The active Master Page: </strong><br />
<span style="background: yellow none repeat scroll 0% 50%; font-size: 10pt; font-family: &quot;Courier New&quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">&lt;%</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">Master</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span> <span style="color: red;">EnableTheming</span><span style="color: blue;">="true"</span> <span style="color: red;">AutoEventWireup</span><span style="color: red;">="true"<br />
CodeFile</span><span style="color: blue;">="MasterPage.master.cs"</span> <span style="color: red;">Inherits</span><span style="color: blue;">="MasterPage"</span> <span style="background: yellow none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">%&gt;</span></span></p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;!</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">DOCTYPE</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span> <span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> </span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"</span> <span style="color: blue;">&gt;</span><br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">runat</span><span>="server"&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0<span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;</span></span></p>
<p class="MsoNormal"><strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">asp</span><span style="color: blue;">:</span><span style="color: maroon;">contentplaceholder</span> <span style="color: red;">id</span><span style="color: blue;">="ContentPlaceHolderHead"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: blue;">/&gt;</span></span></strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span>="server"&gt;</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><strong><span style="color: blue;">&lt;</span><span style="color: maroon;">h1</span><span style="color: blue;">&gt;</span>Hello World!<span style="color: blue;">&lt;/</span><span style="color: maroon;">h1</span></strong><span><strong>&gt;</strong></span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">form</span><span style="color: blue;">&gt;</span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><em><br />
Note: the ASP Content Place Holder between the Head tags and "Hello World!" between the H1 tags.</em></p>
<p class="MsoNormal"><strong>The default Web Form (.aspx page) providing the Content for the Master Page's Content Place Holder:</strong><br />
<span style="background: yellow none repeat scroll 0% 50%; font-size: 10pt; font-family: &quot;Courier New&quot;; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">&lt;%</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: maroon;">Page</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span> <span style="color: red;">Theme</span><span style="color: blue;">="Default"</span> <span style="color: red;">MasterPageFile</span><span style="color: red;">=<span style="color: #0000ff;">"~/MasterPage.master"</span><br />
AutoEventWireup</span><span style="color: blue;">="true"</span> <span style="color: red;">CodeFile</span><span style="color: blue;">="Default.aspx.cs"</span> <span style="color: red;">Inherits</span><span style="color: blue;">="Default"</span> <span style="background: yellow none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">%&gt; </span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">asp</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">:</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">Content</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">ID</span><span style="color: blue;">="Content1"</span> <span style="color: red;">ContentPlaceHolderID</span><span style="color: blue;">="ContentPlaceHolderHead"</span> <span style="color: red;">Runat</span><span>=<span style="color: #0000ff;">"Server"</span>&gt;</span></span></p>
<p class="MsoNormal"><strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">style</span> <span style="color: red;">type</span><span>="text/css"&gt;<br />
</span><span style="color: maroon;">H1</span>{<br />
<span> </span><span style="color: red;">color</span>: <span style="color: blue;">red</span>;<br />
<span> </span>}<br />
<span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">style</span><span style="color: blue;">&gt;</span></span></strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">asp</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">:</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">Content</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><em><br />
Note: the Style element between the ASP Content Place Holder tag - H1 should now be colored red.</em></p>
<p class="MsoNormal"><strong>The contents of StyleSheet.css, the only CSS file in the Active Theme (App_Theme) directory:</strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">H1</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">{<br />
<span> </span><strong><span style="color: red;">color</span>: <span style="color: blue;">blue</span>;</strong><br />
}</span><br />
<em>Note: H1 should still be red because Internal style sheets are supposed to have priority over External style sheets.</em><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></p>
<p class="MsoNormal"><strong>The rendered XHTML:</strong><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;!</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">DOCTYPE</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span> <span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; </span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"</span> <span style="color: blue;">&gt;</span><br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0<span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span><strong> </strong></span><strong><span style="color: blue;">&lt;</span><span style="color: maroon;">style</span> <span style="color: red;">type</span><span>="text/css"&gt;<br />
</span><span style="color: maroon;">H1</span>{<br />
<span> </span><span style="color: red;">color</span>: <span style="color: blue;">red</span>;<br />
<span> </span>}<br />
<span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">style</span></strong><span><strong>&gt;</strong> </span></span></p>
<p><strong><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheet.css"</span> <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">form</span> <span style="color: red;">name</span><span style="color: blue;">="aspnetForm"</span> <span style="color: red;">method</span><span style="color: blue;">="post"</span> <span style="color: red;">action</span><span style="color: blue;">="Default.aspx"</span> <span style="color: red;">id</span><span>="aspnetForm"&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">input</span> <span style="color: red;">type</span><span style="color: blue;">="hidden"</span> <span style="color: red;">name</span><span style="color: blue;">="__VIEWSTATE"</span> <span style="color: red;">id</span><span style="color: blue;">="__VIEWSTATE"</span> <span style="color: red;">value</span><span style="color: blue;">="..."</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span>&gt;</span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span><strong> </strong></span><strong><span style="color: blue;">&lt;</span><span style="color: maroon;">h1</span><span style="color: blue;">&gt;</span>Hello World!<span style="color: blue;">&lt;/</span><span style="color: maroon;">h1</span></strong><span><strong>&gt;</strong></span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">form</span><span style="color: blue;">&gt;</span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><em><br />
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 (</em><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong></strong><span style="color: red;">color</span>: <span style="color: blue;">red</span>;</span><em>) precedes the External style definition (</em><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;">color</span>: <span style="color: blue;">blue</span>;</span><em>). </em></p>
<p><strong>The results in a web browser:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_4_FF_SS1.png" alt="" /><br />
<em>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.</em><br />
<strong>Conclusion;</strong> the ASP Content Place Holder "Work Around" doesn't work well with Themes since ASP.NET automatically includes all the CSS files in the active Theme directory - this behavior disrupts the loading (cascading) orders. This "Work Around" could be useful if you were only using Master Pages or were painfully meticulous with your CSS names and made heavy use of the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#important-rules"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">!important</span></a> style definition.</p>
<p><strong>Another Solution / Another Work Around:</strong><br />
Define the Style element outside the Head tag, directly within the content of your page.<strong> </strong></p>
<p><strong> An example of the Work Around:</strong><br />
<strong>The rendered XHTML:<br />
</strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;!</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">DOCTYPE</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span> <span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</span><br />
</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"</span> <span style="color: blue;">&gt;</span><br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0<span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">style</span> <span style="color: red;">type</span><span>="text/css"&gt;<br />
</span><span style="color: maroon;">H1</span>{<br />
<span> </span><span style="color: red;">color</span>: <span style="color: blue;">red</span>;<br />
<span> </span>}<br />
<span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">style</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheet.css"</span> <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">style</span> <span style="color: red;">type</span><span>="text/css" </span></strong></span><strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">media</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">="screen"</span></strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><strong><span>&gt;<br />
</span><span style="color: maroon;">H1</span>{<br />
<span> </span><span style="color: red;">color</span>: <span style="color: blue;">green</span>;<br />
<span> </span>}<br />
<span> </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">style</span></strong><span><strong>&gt;</strong></span></span></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">form</span> <span style="color: red;">name</span><span style="color: blue;">="aspnetForm"</span> <span style="color: red;">method</span><span style="color: blue;">="post"</span> <span style="color: red;">action</span><span style="color: blue;">="Default.aspx"</span> <span style="color: red;">id</span><span>="aspnetForm"&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">div</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">input</span> <span style="color: red;">type</span><span style="color: blue;">="hidden"</span> <span style="color: red;">name</span><span style="color: blue;">="__VIEWSTATE"</span> <span style="color: red;">id</span><span style="color: blue;">="__VIEWSTATE"</span> <span style="color: red;">value</span><span style="color: blue;">="..."</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;/</span><span style="color: maroon;">div</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">h1</span><span style="color: blue;">&gt;</span>Hello World!<span style="color: blue;">&lt;/</span><span style="color: maroon;">h1</span><span>&gt;<br />
</span><span style="color: blue;">&lt;/</span><span style="color: maroon;">form</span><span style="color: blue;">&gt;</span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">body</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
</span><em>Note: the Style element (</em><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: red;">color</span>: <span style="color: blue;">green</span>;</span><em>)inside the Body tag.</em></p>
<p><strong> The results in a web browser:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_4_FF_SS2.png" alt="" /><br />
<em>Note: "Hello World!" is green as expected.</em><br />
<strong>The Pros and Cons to this (the Style element outside the Head tag) approach:</strong><br />
<strong>Cons:</strong></p>
<ol>
<li> It's not a recommended best practice, but is used by some of the larger sites like <a href="http://amazon.com/">Amazon</a> and <a href="http://www.yahoo.com">Yahoo!</a></li>
<li> It's not valid <a href="http://en.wikipedia.org/wiki/XHTML">XHTML</a> (but neither are iframes in <a href="http://www.w3.org/TR/xhtml1/#strict">XHTML Strict</a>)</li>
</ol>
<p><strong>Pros:</strong></p>
<ol>
<li> Can use <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">Microsoft's Conditional Comments</a></li>
<li> Can use the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">CSS @Import rule</a></li>
<li> Can use the <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">CSS @Media rule</a></li>
<li> Can use multiple <a href="http://www.w3.org/TR/REC-CSS2/media.html">CSS Media types</a></li>
<li> Can easily use <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.1">Media-dependent cascades</a></li>
<li> Can easily control the CSS load order (<a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.2">inheritance and cascading</a>)</li>
<li> It's fairly intuitive and understandable</li>
<li> It's compatible with Revision Control Systems</li>
</ol>
<p><strong>Conclusion;</strong> Themes are a nice addition to ASP.NET, but have some significant design flaws particularly in the way it uses CSS. Themes aren't recommended for complex web applications that make heavy use of CSS, but for small projects they may be a nice option.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 - Defining the Load Order (Cascades) for CSS (Work Around #3)</title>
		<link>http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/</link>
		<comments>http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/#comments</comments>
		<pubDate>Sat, 03 Feb 2007 19:30:21 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,003772b4-6ef1-4a6c-ba46-f122c787a052.aspx</guid>
		<description><![CDATA[ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Stye Sheet (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on <a href="http://en.wikipedia.org/wiki/Css">Cascading Stye Sheet (CSS)</a>, but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your application is even developed, instead I suggest sticking with CSS and perhaps using some default Skins that define CSS selectors like classes or IDs.</p>
<p><strong>The Problem / Question:</strong><br />
Is it possible to define the loading order (<a href="http://www.w3.org/TR/REC-CSS2/cascade.html#cascade">cascades</a>) of CSS files while using Themes in ASP.NET 2.0?</p>
<p><strong>The Solutions / Work Arounds:</strong><br />
Order your CSS files alphanumerically - ASP.NET 2.0 parses through the active Theme directory and all sub directories alphanumerically including every CSS file into the HTML head (via an <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3">external link</a>) of the rendered page.</p>
<p><strong>An example of the problem (when load order isn't defined).<br />
</strong><em>Note: both examples use the same CSS files, but use different loading orders.</em></p>
<p><strong>The directory structure and StyleSheets:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_VS05_SS1.png" alt="" /></p>
<p class="MsoNormal"><strong>The rendered XHTML:</strong><br />
<span style="font-size: xx-small;"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"&gt;</span><br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0 <span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/Controls/<strong>OverloadedUserWebControlStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/Controls/<strong>ReusedUserWebControlStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/<strong>OverloadedStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/<strong>ReusedStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></span></p>
<p><strong>The results in a web browser:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_IE_SS1.png" alt="" /></p>
<p><strong><span style="font-size: 12pt; font-family: &quot;Times New Roman&quot;;">An example of the problem (when load order has been defined alphanumerically).</span></strong></p>
<p><strong>The directory structure and StyleSheets:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_VS05_SS2.png" alt="" /><br />
<em>Note: the use of alphanumeric delimiters preceding the Style Sheet names.</em></p>
<p class="MsoNormal"><strong>The rendered XHTML:</strong><br />
<span style="font-size: xx-small;"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">html</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"&gt; </span><br />
&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;<br />
<span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0 <span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/<strong>aa_ReusedStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/Controls/<strong>01_ReusedUserWebControlStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/Controls/<strong>09_OverloadedUserWebControlStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;<br />
</span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span>="App_Themes/Default/<strong>zz_OverloadedStyleSheet.css</strong>"<br />
</span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt;</span><span style="color: blue;"> </span><br />
&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></span><br />
<em>Note: the ordering of the CSS files.</em></p>
<p>The results in a web browser:<br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_IE_SS2.png" alt="" /></p>
<p><strong> Comparing the web browser results:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_IE_SS1.png" alt="" /> <img src="http://adam.kahtava.com/journal/images/blog/TPWTAS_3_IE_SS2.png" alt="" /><br />
<strong>The Pros and Cons to this approach:</strong></p>
<p><strong>Cons:</strong></p>
<ol>
<li> Being a work around it's not intuitive _ a maintenance programmers nightmare - "I'm familiar with CSS, but how are the Cascading Style Sheets being loaded??"</li>
<li> Contributes to a fragile environment - the way ASP.NET parses through the App_Themes directories may change in newer versions of ASP.NET, not to mention changing a filename could have negative side effects on the site's design.</li>
</ol>
<p><strong>Pros:</strong></p>
<ol>
<li> Allows a load order to be defined</li>
<li> Compatible with <a href="http://en.wikipedia.org/wiki/Version_control">Revision Control Systems</a></li>
</ol>
<p><strong>In conclusion;</strong> Themes are a nice addition to ASP.NET, but have some significant design flaws particularly in the way it uses CSS. Themes aren't recommended for complex web applications that make heavy use of CSS, but for small projects they may be a nice option.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Underscore (_) rendering issues with Cascading Style Sheets (CSS) in Internet Explorer (IE), Firefox, and other browsers</title>
		<link>http://adam.kahtava.com/journal/2007/01/07/underscore-_-rendering-issues-with-cascading-style-sheets-css-in-internet-explorer-ie-firefox-and-other-browsers/</link>
		<comments>http://adam.kahtava.com/journal/2007/01/07/underscore-_-rendering-issues-with-cascading-style-sheets-css-in-internet-explorer-ie-firefox-and-other-browsers/#comments</comments>
		<pubDate>Sun, 07 Jan 2007 21:22:46 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,3ac7da1a-d857-4cdf-b81a-e62fe30d6ddd.aspx</guid>
		<description><![CDATA[The World Wide Web Consortium (W3C) Cascading Style Sheets (CSS) 2 specifications introduced the underscore (_) as a valid CSS naming character, this allows CSS selectors like class selectors and ID selectors to be named like:

 ._menu_item_1
 #_menu_item_2
 .menu_item_3
 #menu_item_4

However; rendering inconsistencies remain among most popular browsers when Styles, Classes, or IDs are preceded by [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.w3.org/">The World Wide Web Consortium (W3C)</a> <a href="http://www.w3.org/TR/REC-CSS2/">Cascading Style Sheets (CSS) 2 specifications</a> introduced the underscore (_) as a valid CSS naming character, this allows CSS selectors like <a href="http://www.w3.org/TR/REC-CSS2/selector.html#class-html">class selectors</a> and <a href="http://www.w3.org/TR/REC-CSS2/selector.html#id-selectors">ID selectors</a> to be named like:</p>
<ul>
<li> ._menu_item_1</li>
<li> #_menu_item_2</li>
<li> .menu_item_3</li>
<li> #menu_item_4</li>
</ul>
<p>However; rendering inconsistencies remain among most popular browsers when Styles, Classes, or IDs are preceded by the underscore character.</p>
<p><strong>Inconsistencies:</strong></p>
<p>CSS Classes and IDs with an underscore immediately after their respective delimiter ('.' Or '#') are rendered by both Firefox and Opera, but <strong>NOT by Internet Explorer</strong>.<br />
<strong>This CSS example will NOT work in Internet Explorer, but WILL work in Firefox and Opera:</strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><strong><span style="color: maroon;">._idTest1</span>{</strong><br />
<span> </span><span style="color: red;">background-color</span>: <span style="color: blue;">red</span>;<br />
<span> </span>}<br />
<span> </span><strong><span style="color: maroon;">#_id_Test2</span>{</strong><br />
<span> </span><span style="color: red;">background-color</span>: <span style="color: blue;">red</span>;</span></p>
<p class="MsoNormal">Style entries preceded by an underscore are rendered by Internet Explorer (IE 6 &amp; 7), but <strong>NOT by Mozilla / Gecko (Firefox) or Opera</strong>.</p>
<p><strong>This CSS example will only work in Internet Explorer:</strong></p>
<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: maroon;">*</span>{<br />
<span> </span><span style="color: red; font-weight: bold;">_color</span>: <span style="color: blue; font-weight: bold;">green</span>;<span><br />
</span>}</span></p>
<p>This is a documented quirk and bug, see <a href="http://wellstyled.com/css-underscore-hack.html">The Underscore Hack</a> and <a href="http://www.easy-designs.net/articles/ieUnderscoreBug/">IE Underscore Bug Test</a> for more information.</p>
<p><strong>The Results of our Underscored CSS in Internet Explorer:</strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/UnderscoreTest1_IE.png" alt="" /></p>
<p><strong>The Results of our Underscored CSS in FireFox (rendered the same in Opera):</strong><strong></strong><br />
<img src="http://adam.kahtava.com/journal/images/blog/UnderscoreTest1_FF.png" alt="" /></p>
<p>This CSS quirk came up in an <a href="http://en.wikipedia.org/wiki/ASP.NET">ASP.NET</a> forum, where a poster was having cross browser issues with his menu controls. We discovered that <span><span style="font-family: arial; font-size: x-small;"><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">xhtmlConformance</span><span style="color: #ff0000;"> mode</span><span style="color: #0000ff;">="Legacy"</span><span style="color: #ff0000;"> </span><span style="color: #0000ff;">/&gt;</span></span></span> was defined in his web.config file which caused the ASP.NET Master Page control (ctl00) to be preceded by an underscore (_ctl00) which was preventing the CSS from being rendered in IE.</p>
<p><strong>Related links:</strong><br />
The <a href="http://www.easy-designs.net/articles/ieUnderscoreBug/">IE Underscore Bug Test</a><br />
The original forum thread: <a href="http://forums.asp.net/thread/1504767.aspx">menu control in master page does not get styles in ie 6.0</a>.<br />
ScottGu's Blog: <a href="http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx">Gotcha: Don't use &lt;xhtmlConformance mode="Legacy"/&gt; with ASP.NET AJAX</a><br />
View the complete source code for my Underscore Test or try it on your favorite browser <a href="http://adamdotcom-script.googlecode.com/svn/trunk/Etcetera/the-css-underscore-test.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2007/01/07/underscore-_-rendering-issues-with-cascading-style-sheets-css-in-internet-explorer-ie-firefox-and-other-browsers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Now supporting Opera 9 and other Web Development (CSS) Related Notes</title>
		<link>http://adam.kahtava.com/journal/2006/12/09/now-supporting-opera-9-and-other-web-development-css-related-notes/</link>
		<comments>http://adam.kahtava.com/journal/2006/12/09/now-supporting-opera-9-and-other-web-development-css-related-notes/#comments</comments>
		<pubDate>Sat, 09 Dec 2006 19:00:07 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[DOM]]></category>

		<category><![CDATA[Firebug]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Opera]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,5efaf26f-23e5-410c-83c7-8177e09326c1.aspx</guid>
		<description><![CDATA[I noticed that a couple visitors were using the Opera web browser, so I decided to check my site with this highly W3C CSS compliant browser - see the "Acid2 Test".
To my horror, I found my CSS wasn't working properly.
My blog in Opera (the CSS rendering issue):

I began debugging my site by starting up Firefox [...]]]></description>
			<content:encoded><![CDATA[<p>I noticed that a couple visitors were using the <a href="http://www.opera.com/">Opera</a> web browser, so I decided to check my site with this highly <a href="http://www.w3.org/Style/CSS/">W3C CSS</a> compliant browser - see the <a href="http://en.wikipedia.org/wiki/Acid2">"Acid2 Test"</a>.</p>
<p>To my horror, I found my CSS wasn't working properly.</p>
<p>My blog in Opera (the CSS rendering issue):<br />
<img src="http://adam.kahtava.com/journal/images/blog/adam.kahtava.com.opera.error.png" alt="" /></p>
<p>I began debugging my site by starting up <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> with the <a href="http://www.getfirebug.com/">Firebug</a> extension. Upon inspecting my <a href="http://www.w3.org/DOM/">Document Object Model (DOM)</a> and my rendered CSS I found a syntax error (a bug).</p>
<p>Using the Firebug extension for Firefox to view the DOM and related errors:<br />
<img src="http://adam.kahtava.com/journal/images/blog/adam.kahtava.firebug.error.png" alt="" /></p>
<p><strong>My error;</strong> I had erroneously entered <span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">*/</span> instead ofÂ <span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">/*</span> for my CSS comment. After making the changes everything rendered as expected in Opera.</p>
<p><strong>Conclusion;</strong> My site now works with Opera 9. As a rule of thumb, I generally do my CSS design in a more W3C CSS compliant browser like Firefox, Opera, etc... and then make the respective changes for proper display in IE. <a href="http://getfirebug.com/">Firebug</a> is amazing, the best web development tool I have seen in a long time. Firebug really makes debugging a breeze.</p>
<p>Other useful Firefox extensions:</p>
<ul>
<li> <a href="http://www.iosart.com/firefox/colorzilla/">Colorzilla</a> - Advanced Eyedropper, ColorPicker, Page Zoomer and other colorful goodies.</li>
<li> <a href="https://addons.mozilla.org/firefox/1532/">del.icio.us</a> - Keep, share and discover all your favorite things.</li>
<li> <a href="http://fasterfox.mozdev.org/">FasterFox</a> - Performance and network tweaks for Firefox.</li>
<li> <a href="https://addons.mozilla.org/firefox/1843/">FireBug</a> - Edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.</li>
<li> <a href="http://greasemonkey.mozdev.org/">Greasemonkey</a> - Customize the way webpages look and function (hide search engine advertisements, tweak Gmail).</li>
<li> <a href="https://addons.mozilla.org/firefox/39/">Mouse Gestures</a> - Allows you to execute common commands (like page forward/backward, close tab, new tab) by mouse gestures drawn over the current webpage, without reaching for the toolbar or the keyboard.</li>
</ul>
<p>Other useful Internet Explorer extensions / toolbars:</p>
<ul>
<li> <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&amp;displaylang=en">Internet Explorer Developer Toolbar Beta 3</a> - Tools for quickly creating, understanding, and troubleshooting Web pages</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/12/09/now-supporting-opera-9-and-other-web-development-css-related-notes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 - Defining a Media Type(s) (Work Around #2)</title>
		<link>http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/</link>
		<comments>http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/#comments</comments>
		<pubDate>Sat, 11 Nov 2006 16:34:50 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,63d6c2f3-4cd9-4a7d-ab5a-2796033cb3a1.aspx</guid>
		<description><![CDATA[ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Stye Sheet (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on <a href="http://en.wikipedia.org/wiki/Css">Cascading Stye Sheet (CSS)</a>, but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your application is even developed, instead I suggest sticking with CSS and perhaps using some default Skins that define CSS classes or IDs.</p>
<p><strong>The Problem / Question:</strong><br />
Is it possible to define CSS Media types (like <span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">media</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">="print"</span>) in the HTML Head tag? ASP.NET 2.0 automatically includes all my CSS files (from the active Theme directory) into the <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> Head tag, but Themes don't allow me to specify any <a href="http://www.w3.org/TR/REC-CSS2/media.html">CSS Media types</a>.</p>
<p><strong>The Solutions / Work Arounds:</strong><br />
Sub class the <a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlhead_members.aspx">HtmlHead class</a> to enumerate through the child controls and add new Meta attributes to the child controls using the <a href="http://msdn2.microsoft.com/en-US/library/system.web.ui.htmlcontrols.htmllink_properties.aspx">HtmlLink class</a>. In order to use multiple Media types you would probably need to use more complex logic and resolve Media types to filenames (i.e. SomeFileName_Print.css could resolve to <span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">media</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">="print"</span>) - for more information on manipulating the HtmlHead class read <a href="http://weblogs.asp.net/pscott/default.aspx">Phil Scott's</a> post titled: <a href="http://weblogs.asp.net/pscott/archive/2005/08/30/424039.aspx">Accessing the Html Header in ASP.NET 2.0</a>.</p>
<p><strong>An example of the problem:</strong><br />
The HTML source automatically generated by ASP.NET 2.0 Themes (note the lack of <span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">media</span> attributes):<br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;"> &lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0 <span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/HandHeld.css"</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Print.css"</span><br />
<span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Screen.css"</span><br />
<span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></p>
<p>My desired HTML source (note the <strong><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: red;">media</span></strong> attributes in bold):<br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;"> &lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0 <span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Default.css"</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <strong><span style="color: red;">media</span><span style="color: blue;">=</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong><span style="color: blue;">all</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong></strong> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/HandHeld.css"</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <strong><span style="color: red;">media</span><span style="color: blue;">=</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong><span style="color: blue;">handheld</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong></strong> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Print.css"</span> </span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;"> type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <strong><span style="color: red;">media</span><span style="color: blue;">=</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong><span style="color: blue;">print</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong></strong> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;"> &lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Screen.css"</span> </span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: red;"> type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <strong><span style="color: red;">media</span><span style="color: blue;">=</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong><span style="color: blue;">screen</span></strong></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span style="color: blue;">"</span></span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><strong></strong> <span style="color: blue;">/&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></p>
<p>The Pros and Cons of this approach:<br />
<strong></strong></p>
<p><strong>Cons:</strong></p>
<ol>
<li> Can't use <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">Microsoft's Conditional Comments</a></li>
<li> Can't use the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">CSS @Import rule</a></li>
<li> Can't use the <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">CSS @Media rule</a></li>
<li> Can't easily use multiple <a href="http://www.w3.org/TR/REC-CSS2/media.html">CSS Media types</a></li>
<li> Can't easily control <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3.1">CSS preferred and alternate style sheets</a></li>
<li> Can't easily control the CSS load order (<a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.2">inheritance and cascading</a>)</li>
<li> Contributes to a fragile environment</li>
<li> Not intuitive _ a maintenance programmers nightmare - "I know CSS, but Where are the Media types defined and How are they controlled?"</li>
</ol>
<p><strong>Pros:</strong></p>
<ol>
<li> Can define a single <a href="http://www.w3.org/TR/REC-CSS2/media.html">Media type</a> for all .css files relatively easy</li>
<li> Could define multiple Media types - with more complex logic dependant on .css file naming</li>
<li> Could control CSS preferred and alternate style sheets - with more complex logic dependant on .css file naming</li>
<li> Compatible with <a href="http://en.wikipedia.org/wiki/Version_control">Revision Control Systems</a> (<a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System">CVS</a>, <a href="http://en.wikipedia.org/wiki/Subversion">Subversion</a>, <a href="http://en.wikipedia.org/wiki/Visual_Source_Safe">Visual Source Safe</a>, and so on)</li>
</ol>
<p><strong>In conclusion;</strong> CSS will continue to be the industry design standard - it has been the standard for well over 10 years. CSS is far more powerful than Themes and Skins, I suggest sticking with CSS and perhaps using some default Skins that define CSS classes or IDs.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 - Excluding a CSS folder (Work Around #1)</title>
		<link>http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/</link>
		<comments>http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 00:32:47 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,7e992478-da0f-4ce4-bb43-3a0b58f6f3ad.aspx</guid>
		<description><![CDATA[ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Stye Sheet (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0's Themes and Skins have a number of design flaws - Themes and Skins depend almost entirely on Cascading Stye Sheet (CSS), but don't fully support CSS - I've listed some "Work Arounds" for a couple design flaws. I don't recommend any of these "Work Arounds" since they contribute to software entropy before your application is even developed, instead I suggest sticking with CSS and perhaps using some default Skins that define CSS classes or IDs.</p>
<p><strong>The Problem / Question: </strong><br />
How can I exclude a subdirectory (sub folder) containing <a href="http://en.wikipedia.org/wiki/Css">Cascading Style Sheets (CSS)</a> in a Theme (App_Theme) directory? ASP.NET 2.0 automatically includes all CSS files (.css) from the active Theme directory and sub directories into the rendered HTML page, but doesn't allow me to exclude a folder of CSS files or a single CSS file.</p>
<p><strong>The Solutions / Work Arounds:</strong></p>
<ol>
<li> Create your CSS directory outside the App_Theme directory then map a Virtual Directory inside your Theme directory.</li>
<li> Add a custom VirtualPathProvider to ignore the non-root level CSS files in sub directoriesÂ  - See <a href="http://blogs.msdn.com/davidebb/default.aspx">David Ebbo's</a> article titled: <a href="http://blogs.msdn.com/davidebb/archive/2005/11/27/overriding-asp-net-combine-behavior-using-a-virtualpathprovider.aspx">Overriding ASP.NET combine behavior using a VirtualPathProvider</a>.</li>
</ol>
<p>These "Work Arounds" are useful if you want to do something like this (note: Default.css is sitting in the root of the active Theme directory):</p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">/* Default.css */</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@Import</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> "</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">StyleSheets/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Common.css ";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">@Import</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> "</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">StyleSheets/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">Masterpage.css";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;"> &lt;!--[if IE]&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">@Import</span> "StyleSheets/FixInternetExplorer_Quirks.css";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&lt;![endif]--&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&lt;!--[if IE 7]&gt;</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">@Import</span> "StyleSheets/FixInternetExplorer7Quirks.css";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&lt;![endif]--&gt;</span></p>
<p>Or if you wanted to use an Embedded CSS Statement like this:</p>
<p><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> <span style="color: red;">type</span><span style="color: blue;">="text/css"&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">&lt;!<span style="color: maroon;">--</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">@Import</span> "StyleSheets/HideNavigation.css";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"><span> </span><span style="color: blue;">@Import</span> "StyleSheets/HideSearchBars.css";</span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">--<span style="color: maroon;">&gt;</span></span><br />
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">style</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></p>
<p>The Pros and Cons of this approach:</p>
<p><strong>Cons</strong>:</p>
<ol>
<li> Can't really define <a href="http://www.w3.org/TR/REC-CSS2/media.html">CSS media types</a>, but we can now use the <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">CSS @Media rule</a></li>
<li> Can't control <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3.1">CSS preferred and alternate style sheets</a></li>
<li> Doesn't scale well</li>
<li> Contributes to a fragile development environment</li>
<li> Not very compatible with <a href="http://en.wikipedia.org/wiki/Version_control">Revision Control Systems</a> (<a href="http://en.wikipedia.org/wiki/Concurrent_Versions_System">CVS</a>, <a href="http://en.wikipedia.org/wiki/Subversion">Subversion</a>, <a href="http://en.wikipedia.org/wiki/Visual_Source_Safe">Visual Source Safe</a>, and so on)</li>
<li> Not intuitive _ a maintenance programmer's nightmare, "I know CSS, but Where is the CSS folder?" or "I know CSS, but Why and How are some CSS folders excluded?</li>
</ol>
<p><strong>Pros</strong>:</p>
<ol>
<li> Can control the load order (<a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.2">inheritance and cascading</a>) through the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">CSS @Import rule</a></li>
<li> Can exclude a folder containing CSS files</li>
<li> Can use the <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">CSS @Import rule</a></li>
<li> Can use the <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">CSS @Media rule</a></li>
<li> Can use <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">Microsoft's conditional comments</a></li>
</ol>
<p><strong><br />
In conclusion;</strong> CSS will continue to be the industry design standard - it has been the standard for well over 10 years. CSS is far more powerful than Themes and Skins, I suggest sticking with CSS and perhaps using some default Skins that define CSS classes or IDs.</p>
<p><strong>Related posts: </strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/">Where it all Falls Apart</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Where it all Falls Apart</title>
		<link>http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/</link>
		<comments>http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 01:11:28 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,4df765e2-b408-471e-9999-652cd804b683.aspx</guid>
		<description><![CDATA[Themes and Skins are a promising addition to ASP.NET 2.0, but too immature for large web projects.
The problem with Themes and Skins begins with the way Cascading Style Sheets (CSS) are automatically included into the rendered page. Through compilation logic, ASP.NET 2.0 parses through the directory and sub directories of the active Theme. ASP.NET 2.0 [...]]]></description>
			<content:encoded><![CDATA[<p>Themes and Skins are a promising addition to ASP.NET 2.0, but too immature for large web projects.</p>
<p>The problem with Themes and Skins begins with the way <a href="http://en.wikipedia.org/wiki/Css">Cascading Style Sheets (CSS)</a> are automatically included into the rendered page. Through compilation logic, ASP.NET 2.0 parses through the directory and sub directories of the active Theme. ASP.NET 2.0 automatically includes an external CSS file reference into the HTML Head tag of the rendered page for every CSS file encountered.</p>
<p>Here's an example for a better understanding.</p>
<p>My directory structure:<br />
<img src="http://adam.kahtava.com/journal/Images/blog/TheProblemsWithThemesAndSkins.png" alt="" /></p>
<p>The output generated by Themes from the preceding directory structure:</p>
<pre><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt; </span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span>The Problems With Themes and Skins in ASP.NET 2.0 <span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/HandHeld.css"</span>
   <span style="color: red;">type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Print.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Screen.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheets/FixInternetExplorer7Quirks.css"</span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheets/FixInternetExplorerQuirks.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span>/&gt; </span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheets/HideAdvertisments.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheets/HideBorders.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;"><span> </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/StyleSheets/HideMenus.css" </span>
<span style="color: red;">   type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="color: blue;">/&gt;</span></span>
<span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></pre>
<p>As you can see, the external CSS file references are automatically included in the rendered page - the load order of CSS files seems to depend on the directory and CSS file name. In this example the root directory is parsed alphabetically then the sub directory is parsed alphabetically.</p>
<p>It's neat how ASP.NET 2.0 automatically includes .css files, but this behavior severely limits the use of CSS (see the list below), and encourages developers / designers to create many .css files which introduces new problems - Internet Explorer has a 30 style sheet limitation, see article <a href="http://support.microsoft.com/kb/q262161">Q262161</a>.</p>
<p><strong>Problems:</strong></p>
<ul>
<li> As the name implies Cascading Style Sheets (CSS) depend on the order in which files are loaded (cascades), in addition to other rules like the CSS @import and CSS @Media rule. By automatically loading all .css files into the header, Themes prevent cascades and loading order from being defined.</li>
<li> The automatic inclusion of .css files prevents the use of Microsoft's Conditional Comments.</li>
<li> The automatic inclusion of CSS files omits the CSS Media type.</li>
</ul>
<p><strong>A rough list of CSS features compromised by Themes in ASP.NET 2.0:</strong></p>
<ol>
<li> <a href="http://www.w3.org/TR/REC-CSS2/media.html">CSS media types</a></li>
<li> <a href="http://www.w3.org/TR/REC-CSS2/cascade.html#at-import">The CSS @Import rule</a></li>
<li> <a href="http://www.w3.org/TR/REC-CSS2/media.html#at-media-rule">The CSS @Media rule</a></li>
<li> <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3.1">Preferred and alternate style sheets</a></li>
<li> <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.1">Media-dependent cascades</a></li>
<li> <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.4.2">Inheritance and cascading</a></li>
<li> <a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">The use of Microsoft's Conditional Comments</a></li>
</ol>
<p>An example of when these compromised features are useful:</p>
<pre><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;</span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-family: 'Courier New'; color: #0000ff; font-size: x-small;">&gt;</span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span>  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">title</span><span style="color: blue;">&gt;</span><span style="color: #0000ff;">The Problems With Themes and Skins in ASP.NET 2.0 </span><span style="color: blue;">&lt;/</span><span style="color: maroon;">title</span><span>&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span>  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/HandHeld.css" </span>
<span style="color: red;">    type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="font-size: x-small;"><strong><span style="color: red;">media</span><span style="color: blue;">="handheld"</span></strong></span> <span>/&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span>  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Print.css" </span>
<span style="color: red;">    type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="font-size: x-small;"><strong><span style="color: red;">media</span><span style="color: blue;">="print"</span></strong></span> <span>/&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span>  </span><span style="color: blue;">&lt;</span><span style="color: maroon;">link</span> <span style="color: red;">href</span><span style="color: blue;">="App_Themes/Default/Screen.css" </span>
<span style="color: red;">    type</span><span style="color: blue;">="text/css"</span> <span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span> <span style="font-size: x-small;"><strong><span style="color: red;">media</span><span style="color: blue;">="screen"</span></strong></span> <span>/&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span><span style="color: #008000;">  </span></span><span style="font-size: x-small;"><strong><span style="color: #008000;"><span>&lt;!--[IF IE]&gt;</span></span></strong></span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;"><span>    </span>&lt;link href="App_Themes/Default/StyleSheets/FixInternetExplorerQuirks.css" </span></span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;">
<span style="color: #008000;">      type="text/css" rel="stylesheet" <span style="font-size: x-small;"><strong>media="all"</strong></span> /&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;"><span>  </span><span style="font-size: x-small;"><strong>&lt;![endif]--&gt;</strong></span></span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;"><span>  </span><span style="font-size: x-small;"><strong><span>&lt;!--[IF IE 7]&gt;</span></strong></span></span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;"><span>    </span>&lt;link href="App_Themes/Default/StyleSheets/FixInternetExplorer7Quirks.css" </span></span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;">
<span style="color: #008000;">      type="text/css" rel="stylesheet" <span style="font-size: x-small;"><strong>media="all"</strong></span> /&gt;</span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><span style="color: #008000;"><span>  </span><span style="font-size: x-small;"><strong>&lt;![endif]--&gt;</strong></span></span></span>
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;">&lt;/</span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: maroon;">head</span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;">&gt;</span></pre>
<p>The contents of Print.css or HandHeld.css would generally look something like this:<br />
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: green;">/* Contents of Print.css or HandHeld.css*/ </span></p>
<p><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="font-size: x-small;"><strong>@Import</strong></span></span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: #000000;">"App_Themes/Default/StyleSheets/HideAdvertisments.css";</span></span><br />
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><strong><span style="font-size: x-small;">@Import</span></strong></span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"> <span style="color: #000000;">"App_Themes/Default/StyleSheets/HideBorders.css";</span></span><br />
<span style="font-size: 9pt; font-family: &quot;Courier New&quot;; color: blue;"><strong><span style="font-size: x-small;">@Import</span></strong></span><span style="font-size: 9pt; font-family: &quot;Courier New&quot;;"> "App_Themes/Default/StyleSheets/HideMenus.css";</span></p>
<p><strong>In conclusion</strong>; Themes have a number of design flaws which limit a significant portion of CSS's mature feature set. Themes are OK for small web applications, but not recommended for large / complex applications. While there are "work arounds" for some of the issues on my list, implementing each "work around" contributes to software entropy before your application is even developed. Since Skins and Themes are really based around CSS you might be better off sticking with CSS and a single default ASP.NET 2.0 Skin in which you define some default CSS classes or ID elements for some basic ASP.NET server controls.</p>
<p><strong>Related notes:</strong></p>
<p><strong></strong><strong>Rick Strahl came to a similar conclusion:</strong></p>
<blockquote><p>theming is nice but really most of that can be accomplished with CSS and what Themes offers beyond that is really not that critical. [...] As it stands I don't really see how I can utilize Themes in my apps in a meaningful way. - <a href="http://west-wind.com/WebLog/posts/4803.aspx">Playing around with ASP.NET Themes</a></p></blockquote>
<p><strong><span>Scott Allen makes a great point:</span></strong></p>
<blockquote><p>Web designers will be more comfortable with css files. If you put the design of your site into the hands of professionals than you should be asking them to use css wherever possible. - <a href="http://www.odetocode.com/Articles/423.aspx">Themes In ASP.NET 2.0</a></p></blockquote>
<p><strong>Richard P </strong><strong>makes a related comment:</strong></p>
<blockquote><p>there are so many flaws in Themes and how they use CSS I dont know where to begin! [...] The concept of CSS and the web skin has been around for some years, and we have been building great solutions despite Visual Studio and ASP.NET. - <a href="http://discuss.joelonsoftware.com/default.asp?dotnet.12.451397.4">Themes and Skins Flawed in ASP.NET 2.0</a></p></blockquote>
<p>Learn more about Themes and Skins here: <a href="http://msdn.microsoft.com/msdnmag/issues/05/11/CuttingEdge/default.aspx">A Quick Tour of Themes in ASP.NET 2.0</a>.</p>
<p><strong>Related posts:</strong></p>
<ul>
<li> <a href="http://adam.kahtava.com/journal/2006/11/09/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-excluding-a-css-folder-work-around-1/">Excluding a CSS folder (Work Around #1)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2006/11/11/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-a-media-types-work-around-2/">Defining a Media Type(s) (Work Around #2)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/03/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-defining-the-load-order-cascades-for-css-work-around-3/">Defining the Load Order (Cascades) for CSS (Work Around #3)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/05/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-using-internal-embedded-style-sheets-with-themes-work-around-4/">Using Internal (Embedded) Style with Themes (Work Around #4)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/02/25/the-problems-with-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-creating-printer-friendly-pages-defining-a-css-print-media-type-with-css-while-using-themes-work-around-5/">Creating Printer Friendly Pages (defining a CSS Print Media Type) with CSS While Using Themes (Work Around #5)</a></li>
<li> <a href="http://adam.kahtava.com/journal/2007/04/02/a-resolution-to-the-problems-with-themes-skins-and-cascading-style-sheets-css-putting-the-cascades-back-into-aspnet-20-themes-taking-control-over-css-cascades-load-order-media-types-and-o/">A Resolution to The Problems with Themes, Skins, and Cascading Style Sheets (CSS) - Putting the Cascades back into ASP.NET 2.0 Themes (taking control over CSS Cascades / Load Order, Media Types, and Overrides)</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/11/08/the-problems-with-themes-skins-and-cascading-style-sheets-css-where-it-all-falls-apart/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Reflection on Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 (Part 2)</title>
		<link>http://adam.kahtava.com/journal/2006/10/30/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-2/</link>
		<comments>http://adam.kahtava.com/journal/2006/10/30/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-2/#comments</comments>
		<pubDate>Tue, 31 Oct 2006 00:26:43 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,69f6fc25-9820-4abf-a930-b119401b1dc7.aspx</guid>
		<description><![CDATA[Themes and Skins depend on Cascading Style Sheets (CSS) and HTML / XHTML, but Themes and Skins don't fully support CSS - now that's a paradox.

HTML, XHTML, XML, and other related Markup Languages can all be manipulated through CSS - ASP.NET generates most of these languages. If your not yet familair with ASP.NET 2.0 Themes [...]]]></description>
			<content:encoded><![CDATA[<p>Themes and Skins depend on <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">Cascading Style Sheets (CSS)</a> and <a href="http://en.wikipedia.org/wiki/Html">HTML</a> / <a href="http://en.wikipedia.org/wiki/Xhtml">XHTML</a>, but Themes and Skins don't fully support CSS - now that's a paradox.</p>
<div><img class="aligncenter" src="http://adam.kahtava.com/journal/images/blog/ASP.NET.Skins.Themes.CSSa.png" alt="" width="361" height="200" /></div>
<p>HTML, XHTML, <a href="http://en.wikipedia.org/wiki/Xml">XML</a>, and other related Markup Languages can all be manipulated through CSS - ASP.NET generates most of these languages. If your not yet familair with ASP.NET 2.0 Themes and Skins: <strong>Skins</strong> give developers and designers a little more precision to manipulate server side controls like <a href="http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/datagrid/VB/datagrid5.aspx">datagrids</a>, and <a href="http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/Calendar/VB/Calendar4.aspx">calendars</a>, but Skins fundamentally depend on CSS. <strong>Themes</strong> allow us to group our Skins, CSS files, graphics / images, and so on into logical groups or directories, but Themes really depend on CSS through Skins and CSS (.css) file references.</p>
<p><strong>Both ASP.NET Themes and Skins are directly dependent on Cascading Style Sheets (CSS)</strong>. However; Themes and Skins prohibit a good deal of CSS's functionality - I'll discuss this is my next post. CSS has been with us for over a decade, it's a pretty powerful display mechanism for web applications. CSS can manipulate HTML, XHTML, XML, SVG, XUL and other common Markup Languages.</p>
<p>I've come up with a number Theme and Skin related questions <span style="text-decoration: line-through;">that I have yet to answer</span>.</p>
<p><strong>Questions</strong>:</p>
<p><strong>If Themes and Skins rely on CSS why not just use CSS?</strong><br />
<strong>Answer:</strong> Default Skins are good, they provide hooks (class and ID selectors) for defining CSS. Themes are OK they let us logically group images and design related files, but fall short in a number of areas and are not recommended for large web applications.Â </p>
<p><strong>If it's possible to accomplish all that Skins and Themes offers through CSS why should I make the switch?</strong><br />
<strong>Answer:</strong> Skins can make life easier for your web designers, when used to hook into CSS classes and ID selectors.</p>
<p><strong>CSS is a mature, robust language, it's been around for over 10 years so more designers / developers are familiar with it, why should I switch to a a technology that is unfamiliar to most of the people that will be maintaining the application?</strong><br />
<strong>Answer:</strong> It's not a clear case of CSS vs Themes since you really can't have Themes without CSS. If used properly Themes can augment CSS.</p>
<p><strong>Are Themes and Skins really scalable for a large enterprise level web application?</strong><br />
<strong>Answer:</strong> Not really, having a seperate server or <a href="http://en.wikipedia.org/wiki/Content_Delivery_Network">Content Delivery Network</a> for site resources like images, stylesheets, etc... is probably the best approach. Themes and Skins do prove uesful for small web applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/10/30/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Reflection on Themes, Skins, and Cascading Style Sheets (CSS) in ASP.NET 2.0 (Part 1)</title>
		<link>http://adam.kahtava.com/journal/2006/10/29/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-1/</link>
		<comments>http://adam.kahtava.com/journal/2006/10/29/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-1/#comments</comments>
		<pubDate>Sun, 29 Oct 2006 16:06:18 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[Themes and Skins]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,7febbbfc-c506-45ad-817d-af62ed1645be.aspx</guid>
		<description><![CDATA[While Themes and Skins are new to ASP.NET 2.0, the underlying concepts have been around for a long time. For those unfamiliar with Themes and Skins, skins give web designers greater flexibility to manipulating ASP.NET server side controls (calendars, datagrids, etc...) through Styles / Cascading Style Sheets (CSS). Themes logically group the design tier of [...]]]></description>
			<content:encoded><![CDATA[<p>While Themes and Skins are new to ASP.NET 2.0, the underlying concepts have been around for a long time. For those unfamiliar with Themes and Skins, skins give web designers greater flexibility to manipulating ASP.NET server side controls (calendars, datagrids, etc...) through Styles / Cascading Style Sheets (CSS). Themes logically group the design tier of an application into a common folder or directory (a Theme folder(s)), giving developers the ability to programmatically change (swap), or expose these Themes to the user.</p>
<p>Learn more: <a href="http://msdn2.microsoft.com/en-us/library/ykzx33wh.aspx">ASP.NET Themes and Skins Overview</a>.<br />
See a live example here: <a href="http://www.dotnettreats.com/SampleThemes/Default.aspx">ASP.NET 2.0 Colorful Web Site Starter Kit</a>.</p>
<p>The concept of interchanging layout and changing design styles (Themes) has been around for quite some time. The <a href="http://www.w3.org/TR/html401/present/">W3C Recommendation for Style Sheets in HTML documents</a> outlines the "<a href="http://www.w3.org/TR/html401/present/styles.html#h-14.3.1">alternate stylesheet</a>" that should be interchanged through the browsers menu; unfortunately Internet Explorer (IE) fails to support this method.</p>
<p>An example: changing style sheets with a Mozilla based browser (<a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>).</p>
<div><img src="http://adam.kahtava.com/journal/images/blog/damowmow.com.bubbles.png" alt="" /><br />
<img src="http://adam.kahtava.com/journal/images/blog/damowmow.com.modern.png" alt="" /></div>
<p>See the live example (if you're not using IE) at: <a href="http://www.damowmow.com/indexes/multiple.html">www.damowmow.com</a>.</p>
<p>Other methods for changing design layouts (Themes) range from Client Side Scripts (JavaScript) to Server Side Scripts (ASP, PHP, ASP.NET, and so on).</p>
<p>Learn more about style interchanging scripts and more here: <a href="http://css-discuss.incutio.com/?page=StyleSwitching">Style Switching - css-discuss</a>.</p>
<p>Themes and Skins are a welcome addition to ASP.NET 2.0, they offer a simple solution for grouping design specific files, and a nice way to programmatically change these Themes. However; this simplistic approach significantly hampers the power of Cascading Style Sheets _ I'll discuss my difficulties / problems in subsequent posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/10/29/a-reflection-on-themes-skins-and-cascading-style-sheets-css-in-aspnet-20-part-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A reflection on Cascading Style Sheets (CSS)</title>
		<link>http://adam.kahtava.com/journal/2006/10/12/a-reflection-on-cascading-style-sheets-css/</link>
		<comments>http://adam.kahtava.com/journal/2006/10/12/a-reflection-on-cascading-style-sheets-css/#comments</comments>
		<pubDate>Fri, 13 Oct 2006 00:18:36 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/PermaLink,guid,9343a7f1-47ff-47f3-8db7-c69740506be6.aspx</guid>
		<description><![CDATA[I've been using Cascading Style Sheets (CSS)Â since the mid 90's. The lack of consistent support across browsers had always impeded my shift from table based design to CSS design. When I did make the transition, I can clearly recall the frustration, and confusion that preceded. Lately I've been using Themes and Master Pages (ASP.NET 2.0) [...]]]></description>
			<content:encoded><![CDATA[<p>I've been using <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">Cascading Style Sheets (CSS)</a>Â since the mid 90's. The lack of consistent support across browsers had always impeded my shift from table based design to CSS design. When I did make the transition, I can clearly recall the frustration, and confusion that preceded. Lately I've been using Themes and Master Pages (ASP.NET 2.0) with CSS. Personally I don't like how .NET automagically inserts the CSS file references into the header. Much of CSS's power is determined by the loading order, and the ability to define separate CSS files for <a href="http://en.wikipedia.org/wiki/Internet_Explorer">Internet Explorer (IE)</a>.</p>
<p><strong>I've compiled a list of techniques I find useful when developing CSS:</strong></p>
<p>When designing my CSS I try to use a browser that is W3C compliant (<a href="http://en.wikipedia.org/wiki/Firefox">Firefox</a>, <a href="http://en.wikipedia.org/wiki/Opera_web_browser">Opera</a>), I then apply fixes for the many quirks found in IE.<br />
I find it easier to develop CSS in a text editor, rather than a <a href="http://en.wikipedia.org/wiki/Wysiwyg">WYSIWIG</a> editor - perhaps I'm a bit of a standards geek, but I like to thoroughly understand a technology rather than rely on wizards, etc...</p>
<p>By inserting the code below into a webpage's header you define a CSS file that will only be loaded by IE, this is great for fixing display issues in IE by overloading the effected CSS elements.<br />
<span style="font-family: 'Courier New'; color: #006400; font-size: x-small;">&lt;!--[if IE]&gt;</span><br />
<span style="font-family: 'Courier New'; color: #006400; font-size: x-small;">Â Â Â Â Â Â  &lt;link href="IEQuirkFixFile.css" rel="stylesheet"<br />
Â Â Â  Â Â Â  Â Â Â  type="text/css" media="all" /&gt;</span><br />
<span style="font-family: 'Courier New'; color: #006400; font-size: x-small;">&lt;![endif]--&gt;</span></p>
<p>You can also define different CSS files for different media types like a printer, letting us hide content (like navigation menus) that you don't want printed.<br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #0000ff;">&lt;</span><span style="color: #a52a2a;">link</span> <span style="color: #ff0000;">href=</span><span style="color: #0000ff;">"HideAllNavigationalContent.css"</span> <span style="color: #ff0000;">rel=</span><span style="color: #0000ff;">"stylesheet"</span> <span style="color: #ff0000;">type=</span><span style="color: #0000ff;">"text/css"</span> <span style="color: #ff0000;">media=</span><span style="color: #0000ff;">"print"</span> <span style="color: #0000ff;">/&gt;</span> </span></p>
<p>You can specify other media types like: Braille, handheld, projection, tv, and so on. See more media types here: <a href="http://www.w3.org/TR/REC-CSS2/media.html#media-types">http://www.w3.org/TR/REC-CSS2/media.html#media-types</a></p>
<p>CSS can be applied in 3 different ways: Inline, Embedded, and External (Linked or Imported). It's nice to keep everything in external files as this method promotes a more n-tier approach even in the presentation level, but I also find it convenient to override classes through CSS Embedded blocks.</p>
<p><strong>An example:</strong><br />
The following Embedded CSS will hide a Navigation menu, and increase the Content pane to 100% when inserted into webpage. Using a combination of Embedded and External CSS can allow us to use a single Master Page.</p>
<p><span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #0000ff;">&lt;</span><span style="color: #a52a2a;">style</span> <span style="color: #ff0000;">type=</span><span style="color: #0000ff;">"text/css"</span><span style="color: #0000ff;">&gt;</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">&lt;!-- </span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  #Navigation</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  {</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â Â Â Â Â  display: none;</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  }</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  #MainContent</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  {</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â Â Â Â  max-width: 100%;</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â Â Â Â  width: 100%;</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">Â Â Â  }</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #006400;">--&gt;</span></span><br />
<span style="font-family: 'Courier New'; font-size: x-small;"><span style="color: #0000ff;">&lt;/</span> <span style="color: #a52a2a;">style</span><span style="color: #0000ff;">&gt;</span></span></p>
<p>CSS coupled with <a href="http://en.wikipedia.org/wiki/Svg">SVG (Scalable Vector Graphics)</a> and <a href="http://en.wikipedia.org/wiki/Xml">Extensible Markup Language (XML)</a> is becoming an increasingly powerful technology, and most web applications under the <a href="http://en.wikipedia.org/wiki/Web_2.0">Web 2.0</a> (alternatively known as <a href="http://www.readwriteweb.com/archives/cease_and_desis.php">Chmod 777 web</a> or the <a href="http://www.readwriteweb.com/archives/cease_and_desis.php">Read / Write Web</a>) use CSS, <a href="http://en.wikipedia.org/wiki/Xhtml">XHTML</a>, <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">AJAX</a>, Clean and meaningful URLs (URL Rewriting), and so on.</p>
<p>View a SVG example: <a href="http://www.w3schools.com/svg/svg_examples.asp">http://www.w3schools.com/svg/svg_examples.asp</a></p>
<p><strong>Related links:</strong><br />
<a href="http://www.w3.org/Style/CSS/">Cascading Style Sheets Home Page</a><br />
<a href="http://www.csszengarden.com/">CSS Zen Garden</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2006/10/12/a-reflection-on-cascading-style-sheets-css/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
