<?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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brant Burnett&#039;s Development Blog &#187; CSS</title>
	<atom:link href="http://btburnett.com/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://btburnett.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Apr 2010 12:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simplify CSS and Javascript Compression In Visual Studio</title>
		<link>http://btburnett.com/2010/02/simplify-css-and-javascript-compression-in-visual-studio.html</link>
		<comments>http://btburnett.com/2010/02/simplify-css-and-javascript-compression-in-visual-studio.html#comments</comments>
		<pubDate>Tue, 23 Feb 2010 18:35:26 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=127</guid>
		<description><![CDATA[I&#8217;ve released a new open source tool that performs design-time compression of your CSS and Javascript files in Visual Studio projects.  This can be a big help, since it allows you to easily do it in your project rather than as part of your build/publish process.  And, since it leaves both the compressed and uncompressed [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve released a new open source tool that performs design-time compression of your CSS and Javascript files in Visual Studio projects.  This can be a big help, since it allows you to easily do it in your project rather than as part of your build/publish process.  And, since it leaves both the compressed and uncompressed versions in place, you can still use the uncompressed version for debugging.</p>
<p>Read more about this new tool or download it at <a href="http://btburnett.com/netcompressor">http://btburnett.com/netcompressor</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2010/02/simplify-css-and-javascript-compression-in-visual-studio.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linking Stylesheets From Content Pages</title>
		<link>http://btburnett.com/2008/04/linking-stylesheets-from-content-pages.html</link>
		<comments>http://btburnett.com/2008/04/linking-stylesheets-from-content-pages.html#comments</comments>
		<pubDate>Wed, 02 Apr 2008 13:12:00 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.btburnett.com/?p=7</guid>
		<description><![CDATA[Personally, I find stylesheets to be the best way to apply formating to web pages. Skins certainly have their uses, but they tend to pad out the HTML with lots of redundant information that can be avoided by referencing a stylesheet, thus reducing download times. Stylesheets can be easily added to themes, but sometimes you [...]]]></description>
			<content:encoded><![CDATA[<div xmlns='http://www.w3.org/1999/xhtml'><small>Personally, I find stylesheets to be the best way to apply formating to web pages.  Skins certainly have their uses, but they tend to pad out the HTML with lots of redundant information that can be avoided by referencing a stylesheet, thus reducing download times.  Stylesheets can be easily added to themes, but sometimes you don&#8217;t want to reference all of your stylesheets on every page, which is what happens if you put stylesheets into a theme.</p>
<p>When using master and content pages, this can be a bit tricky.  The common solution isn&#8217;t all that difficult, you just have to add a content section inside the header of your master page.<br /></small><br />
<blockquote><small><font face='Courier New'>&lt;% Master Language=&#8221;VB&#8221; AutoEventWireup=&#8221;false&#8221; CodeBehind=&#8221;SystemMaster.Master.vb&#8221; Inherits=&#8221;MyWebApp.SystemMaster&#8221; %&gt;</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Strict//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#8221;&gt;</p>
<p>&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&gt;<br />&lt;head runat=&#8221;server&#8221;&gt;<br />    &lt;title&amp;gt;Untitled Page&lt;/title&gt;<br />    &lt;asp:ContentPlaceHolder ID=&#8221;HeadEntries&#8221; runat=&#8221;server&#8221;&gt;&lt;/asp:ContentPlaceHolder&gt;<br />&lt;/head&gt;<br />&lt;body&gt;<br />    &lt;asp:ContentPlaceHolder ID=&#8221;Body&#8221; runat=&#8221;server&#8221;&gt;&lt;/asp:ContentPlaceHolder&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;</font><br /></small></p></blockquote>
<p><small>Then on your content page:<br /></small><br />
<blockquote><small><font face='Courier New'>&lt;%@ Page Language=&#8221;vb&#8221; AutoEventWireup=&#8221;false&#8221; MasterPageFile=&#8221;~/SystemMaster.Master&#8221; CodeBehind=&#8221;Page.aspx.vb&#8221; Inherits=&#8221;MyWebApp.Page&#8221; </font><br /><font face='Courier New'>    title=&#8221;Untitled Page&#8221; %&gt;</font></p>
<p><font face='Courier New'>&lt;asp:Content ID=&#8221;HeadEntries&#8221; ContentPlaceHolderID=&#8221;HeadEntries&#8221; runat=&#8221;server&#8221;&gt;</font><br /><font face='Courier New'>    &lt;link rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;styles/styles.css&#8221; /&gt;</font><br /><font face='Courier New'>&lt;/asp:Content&gt;</font></p>
<p><font face='Courier New'>&lt;asp:Content ID=&#8221;Body&#8221; ContentPlaceHolderID=&#8221;Body&#8221; runat=&#8221;server&#8221;&gt;</font><br /><font face='Courier New'>    Insert Body Here&#8230;</font><br /><font face='Courier New'>&lt;/asp:Content&gt;</font><br /></small></p></blockquote>
<p><small>Now this works great for most scenarios, but what if you&#8217;re using URL rewriting in order to dynamically generate your pages based on the URL that was requested?  In that case, the relative path to the stylesheet won&#8217;t work.  If you know that your web application will always be the root application on the server, you can use a path that starts with /, but that isn&#8217;t always the case.  What you really need to do is use an application relative path, starting with a ~/.</p>
<p>Normally you can change your <b>link</b> tag to include <b>runat=&#8221;server&#8221;</b> and it will process application relative paths in the <b>href</b> attribute.  However, this doesn&#8217;t work on content pages for some reason.  Therefore, I&#8217;ve created the class below to help.<br /></small><br />
<blockquote><small><font face='Courier New'>Imports System<br />Imports System.ComponentModel<br />Imports System.Text<br />Imports System.Web<br />Imports System.Web.UI<br />Imports System.Web.UI.WebControls</p>
<p>&lt;DefaultProperty(&#8220;href&#8221;), ToolboxData(&#8220;&amp;lt;{0}:SmartLink runat=&#8221;"server&#8221;"&amp;gt;&amp;lt;/{0}:SmartLink&amp;gt;&#8221;)&gt; _<br />Public Class SmartLink<br />    Inherits WebControl</p>
<p>    &lt;Bindable(True), Category(&#8220;Behavior&#8221;), DefaultValue(&#8220;&#8221;), Localizable(True)&gt; _<br />    Property href() As String<br />        Get<br />            Dim s As String = CStr(ViewState(&#8220;href&#8221;))<br />            If s Is Nothing Then<br />                Return String.Empty<br />            Else<br />                Return s<br />            End If<br />        End Get</p>
<p>        Set(ByVal Value As String)<br />            ViewState(&#8220;href&#8221;) = Value<br />        End Set<br />    End Property</p>
<p>    &lt;Bindable(True), Category(&#8220;Behavior&#8221;), DefaultValue(&#8220;&#8221;), Localizable(True)&gt; _<br />    Property rel() As String<br />        Get<br />            Dim s As String = CStr(ViewState(&#8220;rel&#8221;))<br />            If s Is Nothing Then<br />                Return String.Empty<br />            Else<br />                Return s<br />            End If<br />        End Get</p>
<p>        Set(ByVal Value As String)<br />            ViewState(&#8220;rel&#8221;) = Value<br />        End Set<br />    End Property</p>
<p>    &lt;Bindable(True), Category(&#8220;Behavior&#8221;), DefaultValue(&#8220;&#8221;), Localizable(True)&gt; _<br />    Property type() As String<br />        Get<br />            Dim s As String = CStr(ViewState(&#8220;type&#8221;))<br />            If s Is Nothing Then<br />                Return String.Empty<br />            Else<br />                Return s<br />            End If<br />        End Get</p>
<p>        Set(ByVal Value As String)<br />            ViewState(&#8220;type&#8221;) = Value<br />        End Set<br />    End Property</p>
<p>    Public Overrides Sub RenderBeginTag(ByVal writer As System.Web.UI.HtmlTextWriter)<br />        If rel &amp;lt;&amp;gt; String.Empty Then<br />            writer.AddAttribute(HtmlTextWriterAttribute.Rel, rel)<br />        End If<br />        If type &amp;lt;&amp;gt; String.Empty Then<br />            writer.AddAttribute(HtmlTextWriterAttribute.Type, type)<br />        End If<br />        If href &amp;lt;&amp;gt; String.Empty Then<br />            writer.AddAttribute(HtmlTextWriterAttribute.Href, ResolveClientUrl(href))<br />        End If<br />        writer.RenderBeginTag(HtmlTextWriterTag.Link)<br />    End Sub</p>
<p>End Class</font><br /></small></p></blockquote>
<p><small><br />Now you replace the <b>link</b> tag on the content page with this:<br /></small><br />
<blockquote><small><font face='Courier New'>&lt;cc1:SmartLink runat=&#8221;server&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; href=&#8221;~/styles/style.css&#8221; /&gt;</font><br /></small></p></blockquote>
<p><small>That&#8217;s it, now you have an application relative stylesheet link on your content page that works with URL rewriting.</small></div>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2008/04/linking-stylesheets-from-content-pages.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
