<?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>Cranky Bit &#187; CSS</title>
	<atom:link href="http://blog.crankybit.com/tags/webdev/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.crankybit.com</link>
	<description>Take a byte out of tech!</description>
	<lastBuildDate>Wed, 09 Mar 2011 17:23:58 +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>Why Isn&#8217;t @import Working in my CSS?</title>
		<link>http://blog.crankybit.com/why-isnt-import-working-in-css/</link>
		<comments>http://blog.crankybit.com/why-isnt-import-working-in-css/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 18:17:28 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=303</guid>
		<description><![CDATA[I was improving the CSS of an old intranet web app (written in early 2001) to be closer to standards-compliance (getting it to just look good in Firefox and Safari would be good enough for me). While I was working on that, I noticed a whole bunch of my CSS that was being completely ignored. [...]]]></description>
			<content:encoded><![CDATA[<p>I was improving the CSS of an old intranet web app (written in early 2001) to be <em>closer</em> to standards-compliance (getting it to just look good in Firefox and Safari would be good enough for me). While I was working on that, I noticed a whole bunch of my CSS that was being completely ignored. As it turns out, all of the code in a separate CSS file that was being imported with @import was not being rendered.</p>
<p>FireBug showed me that the CSS wasn&#8217;t being applied to the elements that it should have been applied to. Hmm. Then I used the &#8220;Net&#8221; tab of FireBug to see that Firefox wasn&#8217;t even <em>attempting </em>to load the external CSS file.</p>
<p>The solution is simple. My @import directive was surrounded by other CSS instructions. Whereas IE tolerates this, the actual W3C spec declares that @import directives should appear before any other CSS instructions, and Firefox honors this restriction.</p>
<p>Thus, my @import directive was being ignored. I moved it to the top of the file and everything started working.</p>
<p>The lessons? Don&#8217;t abuse @import directives. Ideally, they should be used only to have a single CSS file that imports several smaller functional CSS files as a means to provide some organization to the CSS. I was using @import mixed in with my other CSS instructions, which is not ideal.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/why-isnt-import-working-in-css/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>An IE Pitfall With Class Name Alteration</title>
		<link>http://blog.crankybit.com/an-ie-pitfall-with-class-name-alteration/</link>
		<comments>http://blog.crankybit.com/an-ie-pitfall-with-class-name-alteration/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 15:23:44 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/an-ie-pitfall-with-class-name-alteration/</guid>
		<description><![CDATA[I recently used the basic principles in Validation Hints For Your Form by askthecssguy.com for a password management application. I didn't notice any problems on my speedy development machine, but when I pushed the app to some beta testers, I noticed some slower-than-expected performance in IE. As it turns out, the problem was due to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently used the basic principles in <a href="http://www.askthecssguy.com/2007/05/validation_hints_for_your_form_1.html" target="_blank">Validation Hints For Your Form</a> by <a href="http://www.askthecssguy.com" target="_blank">askthecssguy.com</a> for a password management application. I didn't notice any problems on my speedy development machine, but when I pushed the app to some beta testers, I noticed some slower-than-expected performance in IE. As it turns out, the problem was due to the JavaScript that would update an element's class, triggered by the onkeyup event of an input field. It was slow enough to even be disruptive to the experience.</p>
<p>Here is an example of a function that could duplicate the slowdown in IE. It could be attached to the onkeyup event of the username field. It will provide immediate feedback by altering the class name of the field's container  when criteria are met (in this case, the value being greater than 7 characters in length). Your CSS and HTML can then determine exactly what that feedback will look like.</p>
<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showCodeTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> checkUsername<span style="color: #66cc66;">&#40;</span>whatYouTyped<span style="color: #66cc66;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fieldset = whatYouTyped.<span style="color: #006600;">parentNode</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> txt = whatYouTyped.<span style="color: #006600;">value</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>txt.<span style="color: #006600;">length</span>&gt; <span style="color: #CC0000;color:#800000;">7</span><span style="color: #66cc66;">&#41;</span> fieldset.<span style="color: #006600;">className</span> = <span style="color: #3366CC;">"welldone"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">else</span> fieldset.<span style="color: #006600;">className</span> = <span style="color: #3366CC;">""</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>As it turns out, the slowdown in IE is due to a general slowdown that IE experiences anytime the class name of the element is changed. It may be unnoticeable if it happens once, but when it happens on every key press, it is noticeable. The slowdown only occurs, however, when the class name is changed, not when the value is referenced. So the easy solution is to compare the existing value to the value you want to set, and only assign the class name if it is different.</p>
<p>You might change the function above to look something like this.</p>
<div class="igBar"><span id="ljavascript-4"><a href="#" onclick="javascript:showCodeTxt('javascript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> checkUsername<span style="color: #66cc66;">&#40;</span>whatYouTyped<span style="color: #66cc66;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fieldset = whatYouTyped.<span style="color: #006600;">parentNode</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> txt = whatYouTyped.<span style="color: #006600;">value</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> newClassName = <span style="color: #3366CC;">""</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>txt.<span style="color: #006600;">length</span>&gt; <span style="color: #CC0000;color:#800000;">7</span><span style="color: #66cc66;">&#41;</span> newClassName = <span style="color: #3366CC;">"welldone"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> fieldset.<span style="color: #006600;">className</span> != newClassName <span style="color: #66cc66;">&#41;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; fieldset.<span style="color: #006600;">className</span> = newClassName;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will theoretically improve performance in all browsers, although it is relatively moot in Firefox, as it doesn't experience the same level of slowdown. But for IE, this tweak in your code will make a noticeable speed improvement.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/an-ie-pitfall-with-class-name-alteration/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Floating Form Labels</title>
		<link>http://blog.crankybit.com/floating-form-labels/</link>
		<comments>http://blog.crankybit.com/floating-form-labels/#comments</comments>
		<pubDate>Tue, 29 May 2007 11:55:39 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/floating-form-labels/</guid>
		<description><![CDATA[I seem to always forget this, so hopefully blogging about it will help me remember and serve as a future reference. We're using labels to line up form elements like so: Name: Address: No problem. Everything looks great. Now I'll take that same concept but add some disparity in the heights of the label and [...]]]></description>
			<content:encoded><![CDATA[<p>I seem to always forget this, so hopefully blogging about it will help me remember and serve as a future reference.</p>
<p>We're using labels to line up form elements like so:</p>
<form name="samp1" id="samp1" style="padding: 10px;" onsubmit="return false;">
<div style="margin-bottom:4px;">
  <label style="float:left; width:95px; line-height: 20px; padding-right: 4px; text-align:right; font-weight:bold; font-size: 12px;" for="samp1name">Name:</label><br />
<input type="text" name="samp1name" id="samp1name">
</div>
<div>
  <label style="float:left; width:95px; line-height: 20px; padding-right: 4px; text-align:right; font-weight:bold; font-size: 12px;" for="samp1addr">Address:</label><br />
<input type="text" name="samp1addr" id="samp1addr">
</div>
</form>
<p>No problem. Everything looks great. Now I'll take that same concept but add some disparity in the heights of the label and the content. For this example, let's use a &lt;div&gt; with multiline content. Let's put borders around the content areas so that we can see what's going on.</p>
<p>Here is the HTML:</p>
<div class="igBar"><span id="lhtml-8"><a href="#" onclick="javascript:showCodeTxt('html-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-8">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><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;">class</span>=<span style="color: #ff0000;">"row"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/label.html"><span style="color: #000000; font-weight: bold;">&lt;label&gt;</span></a></span>Date/Time:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></a></span>5/21/07, 11:14:34am.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><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;">class</span>=<span style="color: #ff0000;">"row"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/label.html"><span style="color: #000000; font-weight: bold;">&lt;label&gt;</span></a></span>Message:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; This is a message.<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; What a very nice message indeed.<span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; I love messages.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Some CSS like this might work:</p>
<div class="igBar"><span id="lcss-9"><a href="#" onclick="javascript:showCodeTxt('css-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-9">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">label <span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">border</span>: 1px <span style="color: #993333;">dashed</span> <span style="color: #993333;">maroon</span>; <span style="color: #000000; font-weight: bold;">width</span>: 95px; <span style="color: #000000; font-weight: bold;">float</span>: <span style="color: #000000; font-weight: bold;">left</span>; <span style="color: #000000; font-weight: bold;">text-align</span>: <span style="color: #000000; font-weight: bold;">right</span>; <span style="color: #000000; font-weight: bold;">font-weight</span>: Bold;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">div<span style="color: #6666ff;">.row </span><span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span>: 7px;<span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">div<span style="color: #6666ff;">.row </span>div <span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">border</span>: 1px <span style="color: #993333;">dashed</span> <span style="color: #993333;">green</span>; <span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That should produce something like this:</p>
<div style="margin-bottom:7px;">
	<label style="line-height: 15px; font-size: 12px; border: 1px dashed maroon; width: 95px; float: left; text-align: right; font-weight: Bold;">Date/Time:</label></p>
<div style="border: 1px dashed green;">5/21/07, 11:14:34am.</div>
</div>
<div class="row">
	<label style="line-height: 15px; font-size: 12px; border: 1px dashed maroon; width: 95px; float: left; text-align: right; font-weight: Bold;">Message:</label></p>
<div style="border: 1px dashed green;">
		This is a message.<br />
		What a very nice message indeed.<br />
		I love messages.
	</div>
</div>
<p></p>
<p>Oh my. That's not the effect I was shooting for. But look at the green borders of the inner divs. They aren't <em>next</em> to the floated label like I'd expect; they are on top of it, but their content still flows around the floated label, which is why the first example above with the text fields looks fine, but this multiline div reveals the actual behavior the div has when it sits below a floating element.</p>
<p>Right around now is when I'm cursing floats and dreaming of the days of table-based layouts. <img src='http://blog.crankybit.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  This behavior is actually intentional though, and once you understand it, it isn't hard to work with. Like the <a href="http://css.maxdesign.com.au/floatutorial/introduction.htm">Float Basics</a> page on <a href="http://css.maxdesign.com.au/floatutorial/index.htm">Floatutorial</a> points out: </p>
<blockquote><p>A floated box is laid out according to the normal flow, then taken out of the flow and shifted to the left or right as far as possible. Content can flow down the right side of a left-floated box and down the left side of a right-floated box.</p></blockquote>
<p>That explanation makes the behavior make perfect sense. The label is taken <em>out of the flow</em>, and thus the &lt;div&gt; sits on top of it. Once you understand that, it is easy to see that a left margin or padding will take care of the div's alignment.</p>
<p>This change:</p>
<div class="igBar"><span id="lcss-10"><a href="#" onclick="javascript:showCodeTxt('css-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-10">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">div<span style="color: #6666ff;">.row </span>div <span style="color: #66cc66;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-left</span>: 105px; <span style="color: #000000; font-weight: bold;">border</span>: 1px <span style="color: #993333;">dashed</span> <span style="color: #993333;">green</span>;<span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Produces the desired effect:</p>
<div style="margin-bottom:7px;">
	<label style="line-height: 15px; font-size: 12px; border: 1px dashed maroon; width: 95px; float: left; text-align: right; font-weight: Bold;">Date/Time:</label></p>
<div style="margin-left: 105px; border: 1px dashed green;">5/21/07, 11:14:34am.</div>
</div>
<div class="row">
	<label style="line-height: 15px; font-size: 12px; border: 1px dashed maroon; width: 95px; float: left; text-align: right; font-weight: Bold;">Message:</label></p>
<div style="margin-left: 105px; border: 1px dashed green;">
		This is a message.<br />
		What a very nice message indeed.<br />
		I love messages.
	</div>
</div>
<p></p>
<p>The final result, without the borders:</p>
<div style="margin-bottom:7px;">
	<label style="line-height: 15px; font-size: 12px; width: 95px; float: left; text-align: right; font-weight: Bold;">Date/Time:</label></p>
<div style="margin-left: 105px;">5/21/07, 11:14:34am.</div>
</div>
<div class="row">
	<label style="line-height: 15px; font-size: 12px; width: 95px; float: left; text-align: right; font-weight: Bold;">Message:</label></p>
<div style="margin-left: 105px;">
		This is a message.<br />
		What a very nice message indeed.<br />
		I love messages.
	</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/floating-form-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Better Way to Handle CSS Issues in IE</title>
		<link>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/</link>
		<comments>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/#comments</comments>
		<pubDate>Sun, 04 Mar 2007 20:05:33 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/</guid>
		<description><![CDATA[All web developers are familiar with the need to tweak their CSS so that it will look presentable in both IE and other more standards-compliant browsers. Many people have declared, some more infamously than others, that people should boycott IE, and have proceeded to develop designs that are standards-compliant but IE-unfriendly. I feel that this [...]]]></description>
			<content:encoded><![CDATA[<p>All web developers are familiar with the need to tweak their CSS so that it will look presentable in both IE and other more standards-compliant browsers. Many people have declared, some more infamously than others, that people should <a href="http://www.windowsitpro.com/Article/ArticleID/47208/47208.html?Ad=1">boycott IE</a>, and have proceeded to develop designs that are standards-compliant but IE-unfriendly. I feel that this is foolish; IE is still the browser of choice by most non-geek web surfers, and unless you're developing in a controlled environment where you can declare the browser to be used, you really should code for any popular browser, and even then, it's just good practice to write clean code that works everywhere.</p>
<p>Alas, I digress. The point is that IE isn't going anywhere for now, and it is a pain sometimes to figure out how to write CSS that renders as close to identical as possible between IE and other browsers like Firefox. There are <a href="http://www.webcredible.co.uk/user-friendly-resources/css/internet-explorer.shtml">several</a> <a href="http://www.positioniseverything.net/explorer.html">sites</a> <a href="http://css.nu/pointers/bugs-ie.html">out</a> <a href="http://www.webmasterworld.com/forum83/4161.htm">there</a> that endeavor to explain the IE bugs and, when possible, provide workarounds. </p>
<p>Sure, I could just alter the CSS to look right in IE, but if I'm not careful, that "fix" then breaks the code in Firefox! So we've come up with hacks to have CSS that other browsers will see but IE ignores. I don't know about you, but I'm tired of trying to understand and remember these tricks for satiating IE.</p>
<p>Welcome to <a href="http://www.quirksmode.org/css/condcom.html">conditional comments</a> in IE. This is yet another IE-specific feature that we can actually use to our advantage to level the playing field.</p>
<p>Conditional comments are just what they sound like: HTML comments. But these comments are coded in such a way that effectively have a conditional statement in them, and any HTML output within the comments will only be included (by IE) if the condition is true. Here is an example.</p>
<div class="igBar"><span id="lhtml-13"><a href="#" onclick="javascript:showCodeTxt('html-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-13">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE 6]&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>I'm running IE 6.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>!<span style="color: #66cc66;">&#91;</span>endif<span style="color: #66cc66;">&#93;</span>--<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>As you can see, any non-IE browser will just ignore all the content, since it's really one large comment. But IE recognizes the conditional logic inside the comment and renders the content accordingly.</p>
<p>Here's an example. This box will have a message if you're on IE, and it will be blank if you're in any other browser:</p>
<blockquote><p><!--[if IE]>You're running IE! Go get Firefox right now!<![endif]--></p></blockquote>
<p>If you wanted, you could use this technique to inject HTML elements specifically for IE.</p>
<p>Yeah. If you want a maintenance nightmare. <em><strong>Do not</strong></em> sprinkle conditional comments in your code.</p>
<p>Rather than having a CSS file littered with IE fixes (or just accepting the variances between IE and Firefox), I would much rather have a single "clean" stylesheet file that is then <em>augmented</em> by an IE-only stylesheet, loaded by IE and ignored by all other browsers via the conditional comments feature.</p>
<p>So, perhaps you might have some code like this in your header:</p>
<div class="igBar"><span id="lhtml-14"><a href="#" onclick="javascript:showCodeTxt('html-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-14">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><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;">href</span>=<span style="color: #ff0000;">"site.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;</span></span><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;">href</span>=<span style="color: #ff0000;">"ie.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>!<span style="color: #66cc66;">&#91;</span>endif<span style="color: #66cc66;">&#93;</span>--<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There is still a very real danger here. You don't want to fall into the tendency to write intolerant CSS that needs a lot of "cleanup" to look good in both browsers. Work hard to make your CSS as  compatible as possible, and leave the <span class="mono">ie.css</span> file exclusively for the rare cases where you could not resolve an inconsistency in IE. When you're done, your <span class="mono">ie.css</span> file should be <em>really</em> small, if you require it at all.</p>
<p>Having said that, however, I think this is a graceful solution. You don't sacrifice the consistency of your HTML nor your CSS, and your only extra work is the tweaking done in your IE stylesheet.  Other solutions like <a href="http://www.positioniseverything.net/articles/cc-plus.html">Targeting IE Using Conditional Comments and Just One Stylesheet</a> over at <a href="http://www.positioniseverything.net/">PositionIsEverything.net</a> recommend adding an IE-specific div tag around your content, which would enable you to have a single stylesheet and to not just include IE-specific styles but also <em>exclude</em> certain styles from IE. Unless you have some CSS that you just can't tweak for IE and you <em>have</em> to exclude it, I definitely prefer the simpler approach of just including a secondary, corrective stylesheet and leaving the HTML alone. But that's just the purist in me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scriptaculous Cheat Sheet</title>
		<link>http://blog.crankybit.com/scriptaculous-cheat-sheet/</link>
		<comments>http://blog.crankybit.com/scriptaculous-cheat-sheet/#comments</comments>
		<pubDate>Mon, 29 Jan 2007 11:14:43 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/scriptaculous-cheat-sheet/</guid>
		<description><![CDATA[If you're not using Scriptaculous yet, start using it! And once you do, you can reference this awesome Scriptaculous Cheat Sheet designed by Amy Hoy of Slash7.  She did a great job at covering the basics, keeping it simple.]]></description>
			<content:encoded><![CDATA[<p>If you're not using <a target="_blank" href="http://script.aculo.us/">Scriptaculous</a> yet, start using it!</p>
<p>And once you do, you can reference this awesome <a target="_blank" href="http://www.slash7.com/articles/2006/04/22/scriptaculous-cheat-sheet-1">Scriptaculous Cheat Sheet</a> designed by Amy Hoy of <a target="_blank" href="http://www.slash7.com/">Slash7</a>.  She did a great job at covering the basics, keeping it simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/scriptaculous-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>24 Ways to Be Extremely Cool</title>
		<link>http://blog.crankybit.com/24-ways-to-be-extremely-cool/</link>
		<comments>http://blog.crankybit.com/24-ways-to-be-extremely-cool/#comments</comments>
		<pubDate>Thu, 23 Feb 2006 19:57:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/24-ways-to-be-extremely-cool/</guid>
		<description><![CDATA[Oh man. I am bubbling with geeky excitement. I love CSS. I love AJAX. Look. I'm dancing. Okay, so I stole the dancing line from Tom Yager. But only because it is so hillarious and yet appropriate. I plan to continue using that line. But what I'm so excited about is an absolutely awesome site [...]]]></description>
			<content:encoded><![CDATA[<p>Oh man. I am bubbling with geeky excitement. I love CSS. I love AJAX. Look. I'm dancing.</p>
<p>Okay, so I stole the <a href="http://weblog.infoworld.com/enterprisemac/archives/2006/02/microsoft_and_m.html">dancing line</a> from Tom Yager. But only because it is so hillarious and yet appropriate. I plan to continue using that line.</p>
<p>But what I'm so excited about is an absolutely awesome site called <a href="http://24ways.org/">24 Ways</a>. This is a great site to take the average Joe Developer and transform him into a web demigod! I haven't had a chance to read the articles closely yet, but they cover a wide span of topics (from CSS to DOM to AJAX and beyond), and the articles have great links to other sites that are just as rich in great lessons and examples in modern web development.</p>
<p>It's enough to make my geeky heart skip a beat. <img src='http://blog.crankybit.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/24-ways-to-be-extremely-cool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Refuses to Support CSS2</title>
		<link>http://blog.crankybit.com/microsoft-refuses-to-support-css2/</link>
		<comments>http://blog.crankybit.com/microsoft-refuses-to-support-css2/#comments</comments>
		<pubDate>Thu, 17 Mar 2005 20:05:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/microsoft-refuses-to-support-css2/</guid>
		<description><![CDATA[As insider news starts spreading regarding IE 7.0, we hear a lot of good and bad things. One question that a lot of web developers had in their brains--and now is becoming clearer--is, "Will Microsoft finally make IE CSS2 compliant?" On the developer side, this very likely is the largest complaint about IE. Check out [...]]]></description>
			<content:encoded><![CDATA[<p>As insider news starts spreading regarding IE 7.0, we hear a lot of good and bad things.  One question that a lot of web developers had in their brains--and now is becoming clearer--is, "Will Microsoft finally make IE CSS2 compliant?" On the developer side, this very likely is the largest complaint about IE.</p>
<p>Check out this article:<br />
<a href="http://www.eweek.com/article2/0,1759,1776943,00.asp?kc=ewnws031705dtx1k0000599">eWeek: CSS Support Could Be Internet Explorer's Weakest Link</a>.</p>
<p>As the title of this post clearly indicates, the answer to that question is, "No." In fact, Microsoft is arguably taking the worst action possible: They will alter (read: "enhance") support for CSS2, but not fully support it at this time. If you still won't be supporting this very important standard, wouldn't it be wiser to just leave your support how it is? Think of the consequences; your alteration to your CSS support will force developers to update code for their sites if they want to keep them clean in IE (which every developer should do, since IE users still represent the majority of web traffic), yet the updates will serve no purpose other than to maintain compatibility with Microsoft, rather than the more noble--and thus more acceptable--purpose of delivering CSS2 compliance to their site.</p>
<p>Thus, when Microsoft finally decides to fully support CSS in IE, developers will be forced to update <em>again</em>.</p>
<p>And the reason for Microsoft's reluctance? According to sources, Microsoft considers CSS2 a "flawed" standard. Sorry, Microsoft, but between IE and CSS2--even if CSS2 <em>is</em> flawed--I'll take the <em>lesser</em> of two evils.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/microsoft-refuses-to-support-css2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

