<?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>Blue Anvil Journal &#187; css</title>
	<atom:link href="http://blue-anvil.com/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blue-anvil.com</link>
	<description>The online blogfolio of Mike Jolley</description>
	<lastBuildDate>Fri, 03 Dec 2010 18:16:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Including CSS &amp; JavaScript in wordpress posts using Custom Fields</title>
		<link>http://blue-anvil.com/archives/including-css-javascript-in-wordpress-posts-using-custom-fields/</link>
		<comments>http://blue-anvil.com/archives/including-css-javascript-in-wordpress-posts-using-custom-fields/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 19:20:55 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Wordpress & plugins]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[posts]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Wordpress development techniques]]></category>

		<guid isPermaLink="false">http://blue-anvil.com/?p=310</guid>
		<description><![CDATA[If you have ever tried to include code in a wordpress post you may have gone through hell trying to get it to output correctly; WordPress&#8217; built in functions for formatting text (autop and texturize) mangle your code making it non-functional. I&#8217;ve tried many solutions in the past, such as disabling wordpress&#8217; formatting functions, however, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-324" title="custom_code" src="http://blue-anvil.com/wp-content/uploads/2009/01/custom_code.gif" alt="custom_code" width="488" height="100" /></p>
<p>If you have ever tried to include code in a wordpress post you may have gone through hell trying to get it to output correctly; WordPress&#8217; built in functions for formatting text (autop and texturize) mangle your code making it non-functional.</p>
<p>I&#8217;ve tried many solutions in the past, such as disabling wordpress&#8217; formatting functions, however, this is not ideal  -especially if you rely on them to clean up your text and properly encode characters. On top of that its not even valid to include certain things such as CSS in the body of a xHTML document.</p>
<p>The solution? Custom fields. This post will show you how.</p>
<p><span id="more-310"></span>First we need to prepare your template. Open your templates header.php file and insert the following php code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$css</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$css</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/style&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$js</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_js'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot;&gt;
    jQuery.noConflict();
    (function($) {
      '</span><span style="color: #339933;">.</span><span style="color: #000088;">$js</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
    })(jQuery);
    &lt;/script&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>When a post is being viewed (single page) this code will check if it contains the custom fields and display them. Notice in this case I&#8217;m using jQuery noConflict; this part is optional (you may not be using jQuery at all) so if you don&#8217;t want jQuery just use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$css</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;style type=&quot;text/css&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$css</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/style&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$js</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom_js'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$js</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/script&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Whist writing a post, add two custom fields: custom_js and custom_css. Fill these with any example code you need to include in the post.</p>
<div id="attachment_313" class="wp-caption aligncenter" style="width: 310px"><a rel="lightbox" href="http://blue-anvil.com/wp-content/uploads/2009/01/screen-capture.png"><img class="size-medium wp-image-313" title="Adding custom css" src="http://blue-anvil.com/wp-content/uploads/2009/01/screen-capture-300x48.png" alt="Adding custom css" width="300" height="48" /></a><p class="wp-caption-text">Adding custom css</p></div>
<p>That&#8217;s it! The code will now show in the page head, perfect for CSS and JS example code.</p>
<div class="examplebox">
<p>And as you can see we can include additional styles in our posts.</p></div>
<p>I hope this technique comes in handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/including-css-javascript-in-wordpress-posts-using-custom-fields/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Creating &#8216;Web 2.0&#8242; Layouts using strips</title>
		<link>http://blue-anvil.com/archives/creating-web-20-layouts-using-strips/</link>
		<comments>http://blue-anvil.com/archives/creating-web-20-layouts-using-strips/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 15:27:54 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blue-anvil.com/?p=247</guid>
		<description><![CDATA[I&#8217;ve seen the &#8216;web 2.0&#8242; layout (full width background, centred content) done in some pretty wacky and different ways, the worst being a background image and then fixed height sections laid on top (if the content wraps or the text is resized&#8230;bam..broken layout). Because of this I am going to demonstrate the method I use [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blue-anvil.com/wp-content/uploads/2008/11/post_strips.gif" alt="Creating Layouts using strips" title="post_strips" class="alignnone size-full wp-image-286" /></p>
<p>I&#8217;ve seen the &#8216;web 2.0&#8242; layout (full width background, centred content) done in some pretty wacky and different ways, the worst being a background image and then fixed height sections laid on top (if the content wraps or the text is resized&#8230;bam..broken layout). </p>
<p>Because of this I am going to demonstrate the method I use &#8211; content strips. Hopefully this will be useful to CSS beginners who want to code this type of layout.</p>
<p><span id="more-247"></span></p>
<p>Essentially, what you do is treat each section, or &#8216;strip&#8217;, separately and layer them like a cake. </p>
<p>Lets take a commonly used design and demonstrate what I mean.</p>
<p><img src="http://blue-anvil.com/wp-content/uploads/2008/11/layout.gif" alt="" title="layout" width="300" height="175" class="aligncenter size-full wp-image-256" /></p>
<p>In the above design as you can see we have a header, a content (with two sub sections), and a footer. The footer and header require a full width background. So, horizontally we can see 3 strips &#8211; header, content, footer.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;header&quot;&gt;&lt;p&gt;Header&lt;/p&gt;&lt;/div&gt;
&lt;div id=&quot;content&quot;&gt;
    &lt;div class=&quot;mainContent&quot;&gt;&lt;p&gt;Main Content&lt;/p&gt;&lt;/div&gt;
    &lt;div class=&quot;subContent&quot;&gt;&lt;p&gt;Sub Content&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;&lt;p&gt;Footer&lt;/p&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>Using CSS we can style each strip, leaving them all as full width elements. Header and footer should get a tiled background image each, and the text should be aligned center (<code>text-align:center;</code>).<br />
<p style="text-align:center"><script type="text/javascript"><!--
google_ad_client = "pub-6928386133078955";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "444444";
google_color_text = "444444";
google_color_url = "444444";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p><br />
The content itself should be centred and is common in all strips &#8211; lets say 700px wide in each section. To keep the content this wide we create a <code>.inner</code> class in the css stylesheet:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.inner</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">700px</span><span style="color: #00AA00;">;</span>     <span style="color: #808080; font-style: italic;">/* Limits its width */</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>   <span style="color: #808080; font-style: italic;">/* Makes this inner div centered */</span>
    <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>    <span style="color: #808080; font-style: italic;">/* Parent strips have center aligned text */</span>
    <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* To clear floats */</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Our HTML now looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;header&quot;&gt;
    &lt;div class=&quot;inner&quot;&gt;
        &lt;p&gt;Header&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;content&quot;&gt;
    &lt;div class=&quot;inner&quot;&gt;
        &lt;div class=&quot;mainContent&quot;&gt;&lt;p&gt;Main Content&lt;/p&gt;&lt;/div&gt;
        &lt;div class=&quot;subContent&quot;&gt;&lt;p&gt;Sub Content&lt;/p&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;
    &lt;div class=&quot;inner&quot;&gt;
        &lt;p&gt;Footer&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre></td></tr></table></div>

<p>See how it works? Each strip can have its own background this way, and can shrink and grow to fit it&#8217;s content without breaking the layout.</p>
<p>As I said before, this is my preferred method of coding these kind of layouts and it has not failed me yet. I hope you found this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/creating-web-20-layouts-using-strips/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>miniXFN Icon set &amp; XFN CSS implementation</title>
		<link>http://blue-anvil.com/archives/minixfn-icon-set-xfn-css-implementation/</link>
		<comments>http://blue-anvil.com/archives/minixfn-icon-set-xfn-css-implementation/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 14:03:30 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[icon]]></category>
		<category><![CDATA[microformat]]></category>
		<category><![CDATA[XFN]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=42</guid>
		<description><![CDATA[XFN (XHTML Friends Network) is a microformat which represents relationships between people with hyperlinks and the use of a simple HTML tag. They can represent colleagues, contacts, sweethearts, friends and more! Based on the XFN icon set by Wolfgang Bartelme I have created a small set of mini icons (9&#215;10 pixels) to represent these links [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blue-anvil.com/miniXFNicons/xfnpost.jpg" class="floatleft" style="float:left;margin:0 4px 4px 0" alt="XML mini Icons" /></p>
<p>XFN (XHTML Friends Network) is a microformat which represents relationships between people with hyperlinks and the use of a simple HTML tag.</p>
<p>They can represent colleagues, contacts, sweethearts, friends and more!</p>
<p>Based on the XFN icon set by <a href="http://bartelme.at/">Wolfgang Bartelme</a> I have created a small set of mini icons (9&#215;10 pixels) to represent these links between people. I have also made a CSS file which shows the relevant icon when the correct XFN rel tag is present.</p>
<p><span id="more-42"></span></p>
<h2>How to create an XFN link</h2>
<p>XFN links are very simple to create, they simply list the relationships in a &#8216;rel&#8217; tag in the anchor, for example:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;http://blue-anvil.com&quot; rel=&quot;me&quot;&gt;Blue Anvil&lt;/a&gt;</pre></div></div>

<p>The above example show a link to my site, therefore marked as &#8216;me&#8217; in the &#8216;rel&#8217; tag. To create your own, you can use the official <a href="http://gmpg.org/xfn/creator">XFN creator</a> which is a very nice, simple, tool.</p>
<h2>My Icons</h2>
<p><img class="floatleft" src="http://blue-anvil.com/miniXFNicons/allicons.gif" alt="Mini XFN icons" /></p>
<p>First off, the icons. As i said before, i based them on the icons by <a href="http://bartelme.at/">Wolfgang Bartelme</a> found on the <a href="http://www.factorycity.net/projects/microformats-icons/">Microformats icons website</a>.</p>
<p><a href="http://blue-anvil.com/download/miniXFN_icons.zip">Download the icons here.</a> &#8211; Downloaded 886 times.
<p>My mini-icons are free to use, just don&#8217;t claim them as your own, and a link would be nice <img src='http://blue-anvil.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>My CSS</h2>
<p>My CSS file, basically, looks for a present REL tag, then styles the link based on the present styles. It cascades, picking out the right icon depending on the rel tag.</p>
<p>It works with modern browsers that support CSS pattern matching.</p>
<p><a href="http://blue-anvil.com/download/XFNiconsCSS.zip">Download the CSS file here.</a> &#8211; Downloaded 785 times.<br />
<h2>See it all working</h2>
<p>I have set up a demo page showing the icons and css file, which you can <a href="http://blue-anvil.com/miniXFNicons/demo.html">view here.</a></p>
<p>I hope you find my icons prove useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/minixfn-icon-set-xfn-css-implementation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using Image replacement techniques</title>
		<link>http://blue-anvil.com/archives/using-image-replacement-techniques/</link>
		<comments>http://blue-anvil.com/archives/using-image-replacement-techniques/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 15:02:55 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Accessibility, Standards & SEO]]></category>
		<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[image replacement]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=29</guid>
		<description><![CDATA[This week Ive been trying out a lot of image replacement techniques in main headings, and their are quite a few available. If you have a graphical header logo on a website, with the sites name, often you wont want to have another heading as plain text. Yet, you should want to have the heading [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blue-anvil.com/img/imgrep.gif" class="floatleft" style="float:left; margin:4px 4px 4px 0"alt="Image Replacement" />This week Ive been trying out a lot of image replacement techniques in main headings, and their are quite a few available. If you have a graphical header logo on a website, with the sites name, often you wont want to have another heading as plain text. Yet, you should want to have the heading readable by screen-readers, and you also want the SEO benefits of the heading.</p>
<p>Ive rounded up my favorite methods, and this entry will show you how to use them, and when to use them.</p>
<p><span id="more-29"></span><br />
<!--adsense--></p>
<h2>Method 1 &#8211; Stick the image in the Heading tag</h2>
<p>This method simple involves putting your logo in a heading tag, and giving it relevant alt and title attributes. It works well with simple logos, but if you want cool rollovers etc, you will need a different method.</p>
<h3>(X)HTML</h3>
<pre><code>&lt;h1&gt;
   &lt;a href="home.htm" title="homepage"&gt;
      &lt;img src="logo.gif" alt="Site name" /&gt;
   &lt;/a&gt;
&lt;/h1&gt;</code></pre>
<p>Suits &#8211; Simple logo&#8217;s with an alt tag, and possibly a link</p>
<p>Pro&#8217;s &#8211; Alt text should remain visible with images off, logo visible when CSS disabled</p>
<p>Con&#8217;s &#8211; No css rollovers, you must resort to Javascript</p>
<h2>Method 2 &#8211; Phark Method &#8211; modified</h2>
<p><!--adsense#postad-->
<p>This method involved using a CSS background image to show the logo. If CSS is disabled you still see the heading text, however with images off and CSS on the logo is hidden, which is a shame.</p>
<p>It works by indenting the text out of sight, and showing the background image. I use this one when I have a transparent logo, e.g. A transparent png, since other methods (like Gilder/Levin below) show the heading text underneath the image.</p>
<p>My modded code below also allows pretty rollovers, a nice addition.</p>
<h3>(X)HTML</h3>
<pre><code>&lt;h1&gt;
    &lt;a title="Homepage" href="home.htm"&gt;
    &lt;span&gt;
        Site name
    &lt;/span&gt;&lt;/a&gt;
&lt;/h1&gt;</code></pre>
<h3>CSS</h3>
<pre><code>h1 a span
{
    	height:164px;
    	width:219px;
    	background: url('logo.png') no-repeat;
    	text-indent: -5000px;
}
h1 a:hover span, div#header h1 a:focus span
{
    	height:164px;
    	width:219px;
    	background: url('logoHover.png') no-repeat;
    	text-indent: -5000px;
}</code></pre>
<p>Suits &#8211; Headings when you want a link, and your logo is transparent.</p>
<p>Pro&#8217;s &#8211; Text displayed when images off, transparent images work, css rollovers work.</p>
<p>Con&#8217;s &#8211; Breaks with images off and CSS on.</p>
<h2>Method 3 &#8211; Gilder/Levin Method &#8211; modified</h2>
<p>This method is my favorite when using opaque images. It works by hiding the text with a background image via CSS, it does however need some un-semantic markup; but thats a small price to pay. The span is basically positioned to cover up the header text, thats the reason it needs to be opaque. And remember; the width and height must match the image!</p>
<h3>(X)HTML</h3>
<pre><code>&lt;h1 id="header"&gt;
	Site name&lt;span&gt;&lt;/span&gt;
&lt;/h1&gt;</code></pre>
<h3>CSS</h3>
<pre><code>h1#header
{
      margin:0; padding:0;
      position:relative;
      width:316px; height:29px;
      overflow:hidden;
}
h1#header span
{
      display:block;
      position:absolute;
      width:316px; height:29px;
      margin:0; padding:0;
      background:url(logo.gif) top left no-repeat;
}</code></pre>
<p>Suits &#8211; Headings when you want a link, and your logo is opaque.</p>
<p>Pro&#8217;s &#8211; Text displayed when images off and also when CSS off.</p>
<p>Con&#8217;s &#8211; Cannot use a transparent image.</p>
<h2>Conclusion</h2>
<p>So they were my favorite methods, but are they best? DO you have better solutions? Leave a comment and tell me your views on image replacement.</p>
<h2>Related reading</h2>
<ul>
<li><a href="http://www.mezzoblue.com/tests/revised-image-replacement/">Revised Image Replacement</a></li>
<li><a href="http://www.alistapart.com/articles/javascriptreplacement">JavaScript Image Replacement</a></li>
<li><a href="http://www.stuffandnonsense.co.uk/archives/mir_image_replacement.html">MIR: Image Replacement</a></li>
<li><a href="http://www.stopdesign.com/articles/replace_text/">Using Background-Image to Replace Text</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/using-image-replacement-techniques/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Experiments with floats: whats the best method of clearance?</title>
		<link>http://blue-anvil.com/archives/experiments-with-floats-whats-the-best-method-of-clearance/</link>
		<comments>http://blue-anvil.com/archives/experiments-with-floats-whats-the-best-method-of-clearance/#comments</comments>
		<pubDate>Wed, 04 Oct 2006 14:56:35 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Browsers & Hacks]]></category>
		<category><![CDATA[clearance]]></category>
		<category><![CDATA[clearfix]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[floats]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=22</guid>
		<description><![CDATA[When developing websites there is one thing I have never kept consistent; the method of clearing floats. It seems every project I take, I seem to do it a different way, well Its about time I sorted it all out in my mind. For those with no clue about what I&#8217;m rambling on about, with [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.blue-anvil.com/img/floats.gif" class="floatleft" alt="Clearing Floats" />When developing websites there is one thing I have never kept consistent; the method of clearing floats. It seems every project I take, I seem to do it a different way, well Its about time I sorted it all out in my mind.</p>
<p>For those with no clue about what I&#8217;m rambling on about, with CSS layouts, when you have a float inside an block-level element, it will collapse in most browsers, since floats have no dimensions. So for instance, if I had a div container with a blue background, and a float inside it, the blue background would not surround the float (and the floats contents), due to the div ignoring the height of the float.</p>
<p>To fix this you need to &#8216;clear&#8217; the float, so the container recognises the fact the float is there, and adjusts its height accordingly.</p>
<p>There are many methods of doing this, personally in the past Ive used most of them, so in this article I will compare the main ones and rate them in terms of:</p>
<ul>
<li>The extra markup</li>
<li>The Amount of CSS</li>
<li>Cross Browser compatibility (I&#8217;m limited to IE5-7, Opera 9, Firefox)</li>
<li>Ease to implement</li>
</ul>
<p><span id="more-22"></span><br />
<!--adsense--></p>
<h2>Understanding the problem</h2>
<p>To demonstrate the problem, I created a simple test page and ran it in various browsers to show what happens.</p>
<h3>Test 1 &#8211; No clearing method, container has width</h3>
<p><em>Firefox:</em></p>
<p class="center"><img id="image51" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/firefox_method0.gif" alt="Firefox, no clearing"/></p>
<p><em>IE7</em></p>
<p class="center"><img id="image54" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie7_method0.gif" alt="IE7, no clearing" /></p>
<p><em>IE6</em></p>
<p class="center"><img id="image53" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie6_method0.gif" alt="IE6, no clearing"/></p>
<p><em>IE5.5</em></p>
<p class="center"><img id="image55" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie55_method0.gif" alt="IE5.5, no clearing"/></p>
<p><em>IE5</em></p>
<p class="center"><img id="image52" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie5_method0.gif" alt="IE5, no clearing"/></p>
<p><em>Opera 9</em></p>
<p class="center"><img id="image56" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/opera_method0.gif" alt="opera, no clearing"/></p>
<p>As you can see from the screen-shots, standards compliant browsers (firefox &#038; opera) do not expand the container to contain the floats, whereas IE does.</p>
<p>This is because the container has a width, and in IE this tells the browser the element &#8216;hasLayout&#8217;, making it contain the floats. Making the container have layout is one of the techniques of fixing boxes in IE.</p>
<p>For fairness in the tests, and showing the methods, I will remove the width from the container, as in most cases containers of floats don&#8217;t have widths. I for one use a lot of &#8216;display:blocks&#8217; to avoid setting the width.</p>
<h3>Test 2 &#8211; No clearing method, container with no width (container inside a wrapper with width).</h3>
<p><em>IE: (all versions did the same thing)</em></p>
<p class="center"><img id="image57" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/iebroken.gif" alt="IE, no width or clearing"/></p>
<p>Thats more like it, Firefox and Opera have the same problem (I wont bore you with the screen-shots), but now IE faces the problem also. This is because the container doesn&#8217;t &#8216;have layout&#8217; now, therefore a clearing method is needed.</p>
<p>Before I go into the methods of clearance, Ill just show you the web page &#038; the code:</p>
<pre><code>&lt;?php $text='&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;style type="text/css"&gt;
&lt;!--
div {margin:0;padding:0;}
p {margin:0;padding:2px;}

div#wrapper{
							background-color:#ccc;
							width:400px;
							}

div#container{
							border:3px double #000;
							background-color:#999;
							font-size:60%;
							color:#fff;
							}
div#float1{
					float:left;
					width:48%;
					background-color:#4499cc;
					border:1px dotted #222;
}
div#float2{
					float:right;
					width:48%;
					background-color:#4499cc;
					border:1px dotted #222;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="wrapper"&gt;
&lt;div id="container"&gt;
    &lt;div id="float1"&gt;
    		 &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc lacinia viverra mauris. Suspendisse potenti. Pellentesque a tortor in ante pharetra commodo. Aliquam erat volutpat. Nam vel turpis. Suspendisse ullamcorper mattis turpis. Vivamus placerat pretium pede. Aenean consequat. In accumsan scelerisque lectus. Aenean suscipit eleifend nulla. Donec pede. Pellentesque quis diam. Aliquam neque. Fusce facilisis, turpis sit amet congue consequat, enim est dignissim nibh, in tristique lectus enim vitae dui. In pede purus, egestas eget, volutpat sit amet, bibendum non, purus.&lt;/p&gt;
    &lt;/div&gt;
		&lt;div id="float2"&gt;
    		 &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc lacinia viverra mauris. Suspendisse potenti. Pellentesque a tortor in ante pharetra commodo. Aliquam erat volutpat. Nam vel turpis. Suspendisse ullamcorper mattis turpis. Vivamus placerat pretium pede. Aenean consequat. In accumsan scelerisque lectus. Aenean suscipit eleifend nulla. Donec pede. Pellentesque quis diam. Aliquam neque. Fusce facilisis, turpis sit amet congue consequat, enim est dignissim nibh, in tristique lectus enim vitae dui. In pede purus, egestas eget, volutpat sit amet, bibendum non, purus.&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;'; echo htmlspecialchars($text); ?&gt;</code></pre>
<p>There, now its time to look at the juicy stuff, the methods for clearing the floats.</p>
<h2>Method 1: The &#8216;clear&#8217; property</h2>
<p>Using the clear property to clear floats is the method recommended by the W3C, and is one of the oldest methods of fixing floats. However, despite this, it is not the best solution, and does make you add a lot of extra markup to pages.</p>
<h3>How it works</h3>
<p>To use this method you add an element with the css property &#8216;clear:both&#8217; at the bottom of the container with the floats inside it. This forces the container to stretch to fill the floats. As you can imagine, a complex layout would need a lot of these clearing elements, with can make the markup bloated &#038; untidy.</p>
<h3>Example code</h3>
<pre><code>&lt;?php $text='&lt;div id="wrapper"&gt;
    &lt;div id="container"&gt;
        &lt;div id="float1"&gt;
        		 &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc lacinia viverra mauris. Suspendisse potenti. Pellentesque a tortor in ante pharetra commodo. Aliquam erat volutpat. Nam vel turpis. Suspendisse ullamcorper mattis turpis. Vivamus placerat pretium pede. Aenean consequat. In accumsan scelerisque lectus. Aenean suscipit eleifend nulla. Donec pede. Pellentesque quis diam. Aliquam neque. Fusce facilisis, turpis sit amet congue consequat, enim est dignissim nibh, in tristique lectus enim vitae dui. In pede purus, egestas eget, volutpat sit amet, bibendum non, purus.&lt;/p&gt;
        &lt;/div&gt;
    		&lt;div id="float2"&gt;
        		 &lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc lacinia viverra mauris. Suspendisse potenti. Pellentesque a tortor in ante pharetra commodo. Aliquam erat volutpat. Nam vel turpis. Suspendisse ullamcorper mattis turpis. Vivamus placerat pretium pede. Aenean consequat. In accumsan scelerisque lectus. Aenean suscipit eleifend nulla. Donec pede. Pellentesque quis diam. Aliquam neque. Fusce facilisis, turpis sit amet congue consequat, enim est dignissim nibh, in tristique lectus enim vitae dui. In pede purus, egestas eget, volutpat sit amet, bibendum non, purus.&lt;/p&gt;
        &lt;/div&gt;
				&lt;div style="clear:both;"&gt;&lt;/div&gt;
    &lt;/div&gt;&lt;!--end container--&gt;
&lt;/div&gt;&lt;!--end wrapper--&gt;'; echo htmlspecialchars($text); ?&gt;</code></pre>
<h3>Testing</h3>
<p><em>IE 6 (same as IE 5.5-7):</em></p>
<p class="center"><img id="image61" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie6_method1.gif" alt="IE6, clear:both"/></p>
<p><em>IE 5:</em></p>
<p class="center"><img id="image60" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie5_method1.gif" alt="IE5, clear:both"/></p>
<p><em>Firefox:</em></p>
<p class="center"><img id="image58" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/firefox_method1.gif" alt="Firefox, clear:both"/></p>
<p><em>Opera:</em></p>
<p class="center"><img id="image59" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/opera_method1.gif" alt="Opera, clear:both"/></p>
<p>As you can see from the results, it cured the float clearance, however there was a small amount of cut off in IE5.</p>
<p><em>Pros:</em></p>
<ul>
<li>Widely Supported</li>
<li>Simple to understand</li>
</ul>
<p><em>Cons:</em></p>
<ul>
<li>Bloated markup</li>
<li>Sometimes you get weird results (e.g extra padding)</li>
</ul>
<p><em>Overall:</em></p>
<ul>
<li>Browser support: 8/10</li>
<li>Markup/css bloat: 2/10</li>
<li>Simplicity: 6/10</li>
<li>Overall Rating: 5/10</li>
</ul>
<h2>Method 2: Using &#8216;Overflow&#8217; properties</h2>
<p>This is the method I have been using the most, it involves adding a simple css style to the container of the floats; overflow.</p>
<p>This method is really simple, by using either &#8216;overflow:auto&#8217; or &#8216;overflow:hidden&#8217;, you give the box layout, and tell the browser that it needs to contain the floats correctly. I wont go though overflow:hidden, because it often shows scrollbars (which looks nasty) so I will focus on the (in my opinion) superior overflow:hidden property.</p>
<h3>The code</h3>
<p>To code, add the overflow property via inline css, or optionally in your stylesheet. I will do it inline:</p>
<pre><code>&lt;div id="container" style="overflow:hidden;"&gt;</code></pre>
<h3>Testing</h3>
<p>Firefox, IE7 &#038; Opera cleared float fine.</p>
<p>IE6 and below did not clear the floats.</p>
<p>The reason that IE6 and below did not work is because they still require &#8216;hasLayout&#8217; to clear the floats. How can we achieve this? By adding a width or a height.</p>
<p>I want to avoid setting width in this example, so I will use a hack to set the height in only IE:</p>
<pre><code>&lt;div id="container" style="overflow:hidden;  _height:1%; "&gt;</code></pre>
<p>This cures IE 6 and 5.5, so thats all the browsers except, alas, IE5 completely hides the content. A shame. To rectify this (if you care about IE5) you will most likely need to find anther way to give the container &#8216;hasLayout&#8217;, for example setting a width. You could set this up in conditional comments, for just IE5, and also make sure you dont give IE5 height:1%, again by using conditional comments (<a href="http://www.blue-anvil.com/archives/how-touse-conditional-comments">my article on conditional comments</a>).</p>
<p>For more information on hasLayout visit this great site <a href="http://www.satzansatz.de/cssd/onhavinglayout.html">http://www.satzansatz.de/cssd/onhavinglayout.html</a>.</p>
<p><em>Pros:</em></p>
<ul>
<li>Good support</li>
<li>Easy to use</li>
<li>No markup bloat</li>
</ul>
<p><em>Cons:</em></p>
<ul>
<li>A pain to use in IE5</li>
</ul>
<p><em>Overall:</em></p>
<ul>
<li>Browser support: 5/10</li>
<li>Markup/css bloat: 9/10</li>
<li>Simplicity: 9/10</li>
<li>Overall Rating: 7/10</li>
</ul>
<h2>Method 3: FnE method</h2>
<p>This method is called the &#8216;Float Nearly Everything&#8217; method. See if yyou can guess what you have to do.</p>
<p>A float which contains a float automatically clears itself, in all of the browsers. This is how it works. Its called &#8216;nearly&#8217; everything since the main container will not always be floated (if its centered on screen for instance) so it will need to be cleared with one of the other methods (e.g a footer with &#8216;clear:both&#8217; in it.</p>
<p>I find this method hard to work with, and inconsistent, since using floats everywhere is awkward. Also you have to remember, you must give floats widths for them to work with this method, adding to the difficulty.</p>
<p><em>Example screenshot of method &#8211; Firefox</em></p>
<p class="center"><img id="image62" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/firefox_method3.gif" alt="Firefox, FNE method"/></p>
<p>With patience this method works, but often its not worth the time it takes, when other methods exist.</p>
<p><em>Pros:</em></p>
<ul>
<li>Can work well</li>
<li>No extra markup</li>
</ul>
<p><em>Cons:</em></p>
<ul>
<li>Complicated</li>
<li>Takes a lot of time to get right</li>
</ul>
<p><em>Overall:</em></p>
<ul>
<li>Browser support: 8/10</li>
<li>Markup/css bloat: 9/10</li>
<li>Simplicity: 3/10</li>
<li>Overall Rating: 6/10</li>
</ul>
<h2>Method 4: Pseudo :after clearfix</h2>
<p><!--adsense#postad--></p>
<p>This is the method I have been using most recently. It uses a pseudo class (:after) to add an invisible full stop inside the container, which makes the container clear correctly. It also needs some conditional comments to make it compatible with browsers that don&#8217;t support :after (IE7) and other older browsers (e.g IE on the Mac).</p>
<p>This method is hard to get your head round, but it works, as I will show soon.</p>
<h3>Dissecting the code</h3>
<p>The first bit of code needed is some css:</p>
<pre><code>.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}</code></pre>
<ul>
<li>The &#8216;:after&#8217; pseudo class makes the browser apply the style after the content of the element &#8216;clearfix&#8217; is applied to.</li>
<li>The &#8216;content&#8217; attribute makes the browser generate a full stop.</li>
<li>The &#8216;display:block&#8217; attribute stops it defaulting to display:inline, which cannot clear elements.</li>
<li>The &#8216;height:0&#8242; attribute stops it taking up space.</li>
<li>The &#8216;clear:both&#8217; attribute clears the floats.</li>
<li>The &#8216;visibility: hidden;&#8217; attribute makes the generated full stop hidden.</li>
</ul>
<p>Now lets look at some browsers, implementing the code so far. I have simply added a class of &#8216;clearfix; to the container class like so:</p>
<pre><code>&lt;div id="container" class="clearfix"&gt;</code></pre>
<p>*note <del datetime="2006-10-05T16:34:11+00:00">remember, if you need to apply a clear fix to a div with an existing classname, just nest another clearfix div/span inside it, since you cannot have two class names in one div.</del> <ins datetime="2006-10-05T16:34:11+00:00">To have more than one class in a div, seperate the class names with a space (thanks for spotting my error Colin).</ins></p>
<p><em>Firefox</em></p>
<p class="center"><img id="image63" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/firefox_method4.gif" alt="Firefox, Clearfix"/></p>
<p><em>IE6</em></p>
<p class="center"><img id="image64" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie6_method4.gif" alt="IE6, clearfix"/></p>
<p>As you can see, its all looking hunky-dory in Firefox, however IE6 (and all the other versions of IE) fails to clear the float.</p>
<p>To fix this, we give the container &#8216;hasLayout&#8217; via conditional comments, we also add a hack to hide it from IE MAC using the holly-hack (I don&#8217;t have the resources to test in IE MAC) like so:</p>
<pre><code>&lt;!--[if IE]&gt;
	&lt;style&gt;
          /* Hides from IE-mac \*/
          * html .clearfix {height: 1%;}
          /* End hide from IE-mac */
	&lt;/style&gt;
&lt;![endif]--&gt;</code></pre>
<p><em>IE6 (same in IE5 and IE5.5)</em></p>
<p class="center"><img id="image65" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie6_method42.gif" alt="IE6, clearfix 2"/></p>
<p><em>IE7</em></p>
<p class="center"><img id="image66" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie7_method4.gif" alt="IE7, clearfix"/></p>
<p>So thats all version less than, and including, 6 done. But, o no, IE7 wont clear the floats. This is due to the face IE 7 has dropped support for the pseudo :after class, and since the holy hack doesn&#8217;t target IE 7 either, the box wont clear. </p>
<p>This is where the display property saves the day. We change the conditional comment code to read:</p>
<pre><code>&lt;!--[if IE]&gt;
	&lt;style&gt;
          .clearfix {display: inline-block;}
          /* Hides from IE-mac \*/
          * html .clearfix {height: 1%;}
          .clearfix {display: block;}
          /* End hide from IE-mac */
        &lt;/style&gt;
&lt;![endif]--&gt;</code></pre>
<p>This gives IE7&#8242;s clearfix a &#8216;display:inline-block&#8217;, giving the clearfix &#8216;hasLayout&#8217;, and then resets the display property inside the hack for all the other IE versions, solving the error.</p>
<p><em>IE7</em></p>
<p class="center"><img id="image67" src="http://www.blue-anvil.com/wp-content/uploads/2006/10/ie7_method42.gif" alt="IE7, clearfix 2"/></p>
<p>And thats a wrap. All browsers are correctly clearing the floats using the clearfix class.</p>
<p><em>Pros:</em></p>
<ul>
<li>Good browser support</li>
<li>Not a lot of extra markup</li>
<li>Simple to reuse, once implemented</li>
</ul>
<p><em>Cons:</em></p>
<ul>
<li>Needs conditional comments</li>
</ul>
<p><em>Overall:</em></p>
<ul>
<li>Browser support: 8/10</li>
<li>Markup/css bloat: 8/10</li>
<li>Simplicity: 7/10</li>
<li>Overall Rating: 8/10</li>
</ul>
<h2>Conclusion</h2>
<p>Overall, I think that the &#8216;clearfix&#8217; pseudo method is the best method, currently, for clearing floats. The clear:both method is too bulky, the FnE method is just unnecessary, and the overflow:hidden method can get messy. </p>
<p>Therefore I have decided to use the &#8220;clearfix&#8221; pseudo class method in future projects, as it seems to balance browser support with ease of use and markup bulk, making it my favorite technique. Blue Anvil now uses this technique (instead of the overflow method I previously used).</p>
<p>I hope this article was useful, and helps you to make your websites.</p>
<h2>References / Further Reading</h2>
<ul>
<li><a href="http://www.positioniseverything.net/easyclearing.html">&#8220;How To Clear Floats Without Structural Markup&#8221;</a></li>
<li><a href="http://www.sitepoint.com/blogs/2005/02/26/simple-clearing-of-floats/">Sitepoint</a></li>
<li><a href="http://orderedlist.com/articles/clearing-floats-fne/">&#8220;Clearing Floats: The FnE Method&#8221;</a></li>
<li><a href="http://www.stuffandnonsense.co.uk/archives/clearing_floats_without_structural_markup_in_ie7.html">Clearing floats without structural markup in IE7</a></li>
<li><a href="http://www.456bereastreet.com/archive/200603/new_clearing_method_needed_for_ie7/">New clearing method needed for IE7?</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/experiments-with-floats-whats-the-best-method-of-clearance/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Going elastic with ems, layout techniques</title>
		<link>http://blue-anvil.com/archives/going-elastic-with-ems-layout-techniques/</link>
		<comments>http://blue-anvil.com/archives/going-elastic-with-ems-layout-techniques/#comments</comments>
		<pubDate>Thu, 07 Sep 2006 14:42:19 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Web design & development]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[ems]]></category>
		<category><![CDATA[layout]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=19</guid>
		<description><![CDATA[Most sites on the web are coded using pixels for widths, which is acceptable, however these sites make it harder for users with poor eyesight to increase the text size whilst keeping the layout in place and usable. That is where ems can help. This guide will explain ems, and show you how to convert [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.blue-anvil.com/img/lens.jpg" class="floatleft" alt="Image of a lens" />Most sites on the web are coded using pixels for widths, which is acceptable, however these sites make it harder for users with poor eyesight to increase the text size whilst keeping the layout in place and usable.</p>
<p>That is where ems can help. This guide will explain ems, and show you how to convert a layout to utilize ems.</p>
<p><span id="more-19"></span><br />
<ins datetime="2006-09-09T13:14:29+00:00"><em>Title changed, I made a mistake, liquid is for % layouts, ems is elastic. Sorry for the confusion, and thanks to Mike Cherim for pointing out my mistake.</em></ins><br />
<!--adsense#postad--></p>
<h2>What are ems?</h2>
<p>An &#8216;em&#8217; is a unit of measurement that is relative to the base font/font size. Basically, where pixels are fixed (a pixel is always the same width), an em&#8217;s width can vary, depending on the font size. This makes them very powerful, as by using ems you can essentially make the widths change depending on user preference.</p>
<h3>Example sites</h3>
<p>Visit the two sites listed below, and resize the text in either firefox or internet explorer (see <a href="#browser">browser support</a> to learn how to do this).</p>
<ul>
<li><a href="http://www.mailsift.com">MailSift</a></li>
<li><a href="http://www.bbc.co.uk">BBC</a></li>
</ul>
<p>Notice anything different between them?</p>
<p>BBC.co.uk has a static, pixel based layout, meaning when the text resizes the layout stays the same. As you can see, resizing too much breaks the layout and ruins the usability.</p>
<p>Mailsift on the other hand, was coded (by me) using ems, meaning as text resizes, the layout does too, keeping the text in pretty much the same place, avoiding the problems on the bbc site.</p>
<p>Other examples of sites that use ems include</p>
<ul>
<li>Blue anvil (your looking at it)</li>
<li><a href="http://www.designbit.co.uk">Designbit</a></li>
<li><a href="http://www.cssliquid.com">cssliquid.com</a></li>
</ul>
<h2>5 reasons why ems can improve accessibility</h2>
<ol>
<li>Internet explorer has trouble resizing pixel font-sizes</li>
<li>Pixel layouts often break when increasing the font size.</li>
<li>Visually impaired people can in effect &#8216;zoom in&#8217; to your page.</li>
<li>People with large monitors can make your site larger by increasing the size.</li>
<li>People with low resolution can make the text smaller, to fit in their windows.</li>
</ol>
<p><a name="browser"></a></p>
<h2>Browser support</h2>
<p>Increasing the text size in the manner I have shown is supported primerily by Firefox and Internet explorer, Opera has its own resizing method (covered in <a href="#future">Future</a>).</p>
<p>To resize in firefox go to view > text size, or use the shortcut keys (control and + or -).</p>
<p>In IE6 go to view > text size, and select a text size.</p>
<p><!--adsense--></p>
<h2>How I convert a site to make it elastic</h2>
<p>This is how I personally make a site elastic with ems. Before trying this please backup your existing css stylesheet, I don’t want your hate mail if you cock it up!</p>
<ol style="margin-left:0;">
<li>Firstly, you need a layout done in CSS (<a href="http://www.blue-anvil.com/tuts/ems/example1.htm">see example 1</a>). The example shows a basic page using pixels for font sizes and the actual layout. Nothing is resizable in IE6.</li>
<li>Now to get your hands dirty. Add the following to the &#8216;body&#8217; style.<br/>
<pre><code>body {
         font-size:62.5%;
}</code></pre>
<p>This is the base font size. I have chosen 62.5% as it is round about 10px, which will represent 1em. <a href="http://www.blue-anvil.com/tuts/ems/example2.htm">See example 2</a>.</li>
<li>Now you have a base font size you can make all other font sizes relative to this value. <a href="http://www.blue-anvil.com/tuts/ems/example3.htm">Example 3</a> shows how I have done this, paragraphs are set as 1.4em, headings are 2em. You can resize the text (in IE) in this example, but the layout is static.</li>
<li>Next we need to work on the layout. Convert the px values to em, divide the value by 10 and add em after it. For example, the container div has a width of 716px, this should be converted to 71.6em, it should look roughly the same. <a href="http://www.blue-anvil.com/tuts/ems/example4.htm">See example 4.</a></li>
</ol>
<p>And that’s basically it, look at <a href="http://www.blue-anvil.com/tuts/ems/example4.htm">example 4</a> and try resizing, the layout should change with the text.</p>
<h3>Testing &#038; what to watch out for</h3>
<p>The main thing to watch out for when setting em widths is that due to inheritance in css, if you change a font size in a div, the width of the ems will need modifying to keep it the same. For example, If I set the font size the 1.4em in the container, the containers width itself would increase. You can avoid this by not changing the font size in divs with widths, or by dividing the width by the new font size. Example; original container width &#8211; 71.6em, divided by new font size (1.4em) makes it roughly 51em to keep it the same width.</p>
<h2>Making images resize with ems</h2>
<p>Images can also be resized with the layout, albeit tricky. To achieve this you shouldn’t set a width for the image in the html, you should set it in css. Look at <a href="http://www.blue-anvil.com/tuts/ems/example4.htm">example 4</a> again; notice the image stays the same size as you resize the text.<br />
By removing the html width and height attribute, we can manipulate this image in css. Add a class of &#8216;image_size&#8217; to the image in the html:</p>
<pre><code>&lt;img class="image_resize" src="lens.jpg" alt="Lens" /&gt;</code></pre>
<p>Now in the css add the following:</p>
<pre><code>.image_resize{
		 float:left;
		 margin-right:8px;
		 margin-bottom:4px;
		 width:12.5em;
		 }</code></pre>
<p>Now the image will resize with the text (<a href="http://www.blue-anvil.com/tuts/ems/example5.htm">see Final example</a>). *Note that using this method requires a different css style for each image if their sizes are not the same.</p>
<p><a name="future"></a></p>
<h2>In the future</h2>
<p>We are already seeing accessibility tweaks regarding resizing, notably in Opera and IE7. These browsers have a built in zoom function, meaning they can resize any page. These improvements mean that in the future we may not need to make our layouts and text sizes increase in the way described in this article, as the browsers will handle it. But for now, If you are keen on accessibility, you should make your site easy to read for the visually impaired, whatever their browser of choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/going-elastic-with-ems-layout-techniques/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to&#8230;use conditional comments</title>
		<link>http://blue-anvil.com/archives/how-touse-conditional-comments/</link>
		<comments>http://blue-anvil.com/archives/how-touse-conditional-comments/#comments</comments>
		<pubDate>Sat, 05 Aug 2006 13:48:59 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Browsers & Hacks]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[conditional comments]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=15</guid>
		<description><![CDATA[Conditional comments have been part of internet explorer since version 5, but a lot of programmers ignore them. This article teaches the basics of using conditional comments, and shows some examples of their uses. A conditional comment is a method of talking directly to a version of internet explorer above version 5, allowing you to [...]]]></description>
			<content:encoded><![CDATA[<p>Conditional comments have been part of internet explorer since version 5, but a lot of programmers ignore them.</p>
<p>This article teaches the basics of using conditional comments, and shows some examples of their uses.</p>
<p><span id="more-15"></span><br />
<!--adsense--></p>
<p>A conditional comment is a method of talking directly to a version of internet explorer above version 5, allowing you to pass<br />
IE specific rules without affecting other browsers such as firefox.</p>
<p>By utilizing conditional comments you can effectively reduce the usage of css hacks to make your web pages compatible with<br />
Internet explorer.</p>
<h2>Common uses</h2>
<p>With conditional comments you can:</p>
<ul>
<li>Target IE specifically</li>
<li>Make IE 5+ ignore a block of code</li>
</ul>
<p>A great usage, for example, would be using conditional comments with CSS style sheets so you can have certain IE specific css rules that you want other browsers to ignore.</p>
<h2>The code</h2>
<p>You may be aware that, in html, the syntax of a normal comment is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--comment goes here--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>Comments can be placed anywhere in the document.</p>
<p>Now, a conditional comment looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!<span style="color: #00AA00;">&#91;</span>if <span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>Conditional comments can also be placed anywhere in your HTML document.</p>
<h2>Types of conditional comment</h2>
<h3>downlevel-hidden</h3>
<p>A <em>downlevel-hidden</em> comment is a comment that is visible <strong>only</strong> to the IE version you are targeting.</p>
<p><strong>Example:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if IE<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>The above code will only be seen by IE versions 5 and up.</p>
<p>Other, older, versions of IE, and also other browsers, will not see the code enclosed by the tags, and will therefore ignore anything you put inside, hence the name, <em>downlevel-<strong>hidden</strong></em>.</p>
<p>The other browsers just see the &lt;&#8211; and &#8211;&#038;rt parts, so it looks like a regular comment to them.</p>
<p>Just to show you, for reference, if you used the code,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if !IE<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>NO browser would see the code. This is because the rule is !IE, which means <em>NOT IE</em>. Therefore IE 5+ wont see the code, and since it is downlevel hidden, no other browsers will either.</p>
<p><strong>Visibility conclusion:</strong></p>
<p>Firefox/non-ie browsers &#8211; code hidden</p>
<p>Targeted IE &#8211; code visible</p>
<h3>downlevel-revealed</h3>
<p>A <em>downlevel-revealed</em> comment is a comment that is visible to the IE version you are targetting, and also non-IE browsers and old versions of IE. It is useful when you wish to make code invisible to a version of internet explorer, but you want non-IE browsers to still see it.</p>
<p><strong>Example:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!<span style="color: #00AA00;">&#91;</span>if !IE<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>The above example would be visible to all browsers except IE versions 5+.</p>
<p><strong>Validity</strong></p>
<p>You may notice that the downlevel-revealed code provided by Microsoft does not validate correctly, the correct code is outlined on <a href="http://www.456bereastreet.com/archive/200511/valid_downlevelrevealed_conditional_comments/">this page</a>, or is shown below:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if !IE<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>--<span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!--&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>The difference between this downlevel-revealed code and the downlevel-hidden code is that the comment is closed after each line, so non-IE browsers will not ignore it.</p>
<p><strong>Visibility conclusion:</strong></p>
<p>Firefox/non-ie browsers &#8211; code visible</p>
<p>Targeted IE &#8211; code visible</p>
<h2>Targeting specific IE versions and extra commands</h2>
<p>The <em>[if ]</em> portion of the conditional comment code has extra functionality so you can target certain versions of IE, or exclude versions. These are outlined below.</p>
<h3>Targeting an IE version</h3>
<p>To target a specific version of IE you just add the version number in the <em>if</em> statement, for example, to target IE 6 only you could use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>You must leave a space between &#8216;IE&#8217; and the version number.</p>
<h3>Targeting multiple IE versions</h3>
<p>If, for example, you wanted to target versions of IE older than IE 6, rather than writing individual statements for each version you could use the <em>&#8216;less than&#8217;</em> comparison :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if lt IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code for versions less than IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">,</span> but not including IE <span style="color: #cc66cc;">6</span>&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>If you wanted to target versions older than, and equal to IE6 you would use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if lte IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>The commands for comparing versions are as follows:</p>
<p><strong>lt</strong> &#8211; less than</p>
<p><strong>lte</strong> &#8211; less than or equal too</p>
<p><strong>gt</strong> &#8211; greater than</p>
<p><strong>gte</strong> &#8211; greater than or equal too</p>
<h3>Excluding an IE version/versions</h3>
<p>To exclude a version you can make use of the ! (NOT) operator, for example, to target all IE versions except IE 6 you could use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if !IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>This would mean <em>if not ie 6</em>.</p>
<p>You could also mix the not operator with multiple IE versions, for example to target all versions of IE except IE 6 and above you could use the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if gte !IE <span style="color: #cc66cc;">6</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
     &lt;em<span style="color: #00AA00;">&gt;</span>your code&lt;/em<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>This would mean <em>if not greater than or equal to ie 6</em>.</p>
<h3>Version Vectors</h3>
<p>Version vectors allow you to target minor versions of IE, for example you could target IE 5.5 instead of IE 5 as a whole. This is particularly useful, as some bugs are fixed in higher versions. The format of a version vector is x.xxxx, but you do not have to make the decimal 4 digits long, e.g 5.0 is valid, as is 5.0000, however the 5.0000 targets the 0000 build of the browser specifically.</p>
<h2>Usage examples</h2>
<p>Some of the best example of usage would be using conditional comments in conjunction with CSS. Say for instance you wanted to fix a box model error in IE 5, rather than use hacks you could just make a separate style sheet for IE 5 with modified width values of an element which wasn’t rendering correctly. You would then add the following to the header of the html page:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if IE <span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
  &lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
    <span style="color: #a1a100;">@import url(ie5.css);</span>
  &lt;/style<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>And hey presto, IE 5 will use the fixed styling, no box model hacks needed. Of course with this method you would have to ensure the conditional comment was after the style sheet include, if not the style would be overwritten by the default style sheet. Of course another method that would not be affected by the order would be to just add the styling directly to the conditional comment :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;!--<span style="color: #00AA00;">&#91;</span>if IE <span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&gt;</span>
  &lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
    <span style="color: #cc00cc;">#element</span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
  &lt;/style<span style="color: #00AA00;">&gt;</span>
&lt;!<span style="color: #00AA00;">&#91;</span>endif<span style="color: #00AA00;">&#93;</span>--<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>Since styles in the document have a higher priority than those in the style sheets, it would take priority.</p>
<p>So there you have it, a simple guide to using conditional comments in your web pages to avoid hacks, I hope this was useful and don’t forget to post a comment. Thanks for reading!</p>
<h2>Further reading</h2>
<p><a href="http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp">Microsofts conditional comments page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/how-touse-conditional-comments/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>My day of buggy hell with IE &#8211; a css story</title>
		<link>http://blue-anvil.com/archives/my-day-of-buggy-hell-with-ie-a-css-story/</link>
		<comments>http://blue-anvil.com/archives/my-day-of-buggy-hell-with-ie-a-css-story/#comments</comments>
		<pubDate>Sun, 30 Jul 2006 13:48:15 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Browsers & Hacks]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[conditional comments]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fixes]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=14</guid>
		<description><![CDATA[As you may well be aware, this has been a pretty hectic week for me, trying to finish all my projects before I leave to go on a well earned holiday. The main thing on my agenda was the blue anvil redesign I&#8217;ve been working on. It all went pretty smoothly, excluding the few set-backs [...]]]></description>
			<content:encoded><![CDATA[<p>As you may well be aware, this has been a pretty hectic week for me, trying to finish all my projects before I leave to go on a well earned holiday.</p>
<p>The main thing on my agenda was the blue anvil redesign I&rsquo;ve been working on. It all went pretty smoothly, excluding the few set-backs I encountered (see my last blog entry), but all in all it went well and the website was looking fairly nice&#8230;in firefox.</p>
<p>Yes, I left the cross browser stuff until last, it would only take an hour or two, right? How wrong was I. This was my day from hell and I have the coffee breath and bad temperament to prove it. With any luck the problems and solutions I used may be<br />
helpful, and save others from a hellish day that I experienced.</p>
<p><span id="more-14"></span></p>
<h2>Bug #1 &#8211; Negative margins</h2>
<p>Negative margins have a variety of uses, I love them to bits. Great for overlapping content or escaping a div. This bug wasn&rsquo;t bad at all, Id experienced it before, and it does make sense why it goes wrong really.</p>
<p>In my case I have a div with padding which my content was being put into. Above the content I wanted to have a strip for the date that was wider then the content itself.</p>
<p>Rather than fiddle with padding, or adding more divs, I went down the negative margin route.</p>
<h3>The code</h3>
<p>The strip was in a box with a padding of 32px.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.date_strip</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">32px</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">-32px</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">-32px</span><span style="color: #00AA00;">;</span> 
<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3>The problem</h3>
<p>The code works as it should in firefox, but IE cuts off the edges of the strip.</p>
<h3>The solution</h3>
<p>Simply add the rule:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span></pre></td></tr></table></div>

<p>Later on in the day (just before I had the urge to put the laptop in the oven and watch it die) I found a second error, this one with Opera 9. Opera 9 would render the left negative margin fine, but cut off the right hand side. To fix this I just added padding to right, as I already did to the left.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">32px</span></pre></td></tr></table></div>

<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 1/10 <strong>Annoyance factor:</strong> 1/10</p>
<h2>Bug #2 &#8211; Form heights</h2>
<p>If you look in the sidebar you will see the search form, I had some problems regarding the height of the input box and the height of the submit button.</p>
<h3>The code</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#searchbox</span> input <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#73B531</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">125px</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#searchbox</span> input<span style="color: #6666ff;">.button</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#8C4</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#692</span><span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">75px</span> !important<span style="color: #00AA00;">;</span>  
<span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3>The problem</h3>
<p>Firefox renders the button with more height than the input box. This was happening when my input button had a border.</p>
<p>I thought that simply adding one pixel of padding to the input box would solve the problem, and it did, but this made IE render the boxes at different heights. To solve this I needed to add<br />
<em>2 padding</em> to the input box, which broke firefox.</p>
<h3>The solution</h3>
<p>Conditional comments were the key to solving this bug. By setting the padding to 1px in the css stylesheet (fixing firefox) i could add a conditional comment to make IE render the same box with 2px padding, solving the problem.</p>
<p>In the header of the document:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if IE]&gt;
      &lt;style&gt;
      #searchbox input{padding:2px;}
      #searchbox input.button{padding:0;}
      &lt;/style&gt;
&lt;![endif]--&gt;</pre></td></tr></table></div>

<p>(check back in a few weeks, I will be covering conditional comments in more detail in a future post).</p>
<p>Despite this there is still a problem, as the boxes are not equal height in opera, as of yet I have not been able to solve this as I cannot find a hack for opera that works well. If you know one, please leave a comment.</p>
<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 3/10 <strong>Annoyance factor:</strong> 7/10</p>
<h2>Bug #3 &#8211; accessible forms</h2>
<p>I was quite disappointed when I found this bug, as I thought my forms were perfect. Well it seems IE has a nasty quirk concerning field set backgrounds.</p>
<p>In firefox and other standard compliant browsers, the field set background goes up to the border, as it should.</p>
<p>In internet explorer the field set background breaks out of the border to fill the legend (the label for the field set) too, making it very difficult to make the forms look the same between browsers.</p>
<h3>The code</h3>
<p>CSS:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#commonform</span> fieldset <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#8FA7C2</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">16px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#commonform</span> legend <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#dbdbdb</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#7191B0</span><span style="color: #00AA00;">;</span>   <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#efefef</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>images/bits2.png<span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat-x</span><span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>HTML</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;fieldset&gt;
&lt;legend&gt;Your Contact Details&lt;/legend&gt;...etc</pre></td></tr></table></div>

<h3>The solution</h3>
<p>To fix the problem in IE, I found that the only way was to position the legend absolutely to the relatively positioned field set, essentially breaking it from the flow so the background wouldn&rsquo;t fill the legends area. The code is quite fiddly to get right, and only works in IE, therefore conditional comments come in handy once again.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if IE]&gt;
      &lt;style&gt;
      #commonform fieldset {margin:0;  margin-bottom:16px;  &lt;strong&gt;position:relative ;&lt;/strong&gt;  background-color:#fff;  border:1px solid #8FA7C2;  padding:16px;}
      #commonform legend {&lt;strong&gt;position:absolute;&lt;/strong&gt;  margin-top:-26px;  font-weight:bold;  border-bottom:1px solid #dbdbdb;  color:#7191B0;  font-size:1.2em;  background:#efefef url(images/bits2.png) repeat-x}
      &lt;/style&gt;
&lt;![endif]--&gt;</pre></td></tr></table></div>

<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 8/10 <strong>Annoyance factor:</strong> 8/10</p>
<h2>Bug #4 &#8211; Safari wrap bug</h2>
<p>This was a quick bug I found with my navbar. My navbar is essentially just an inline list with padding above and below. Its width is set with display:block;.</p>
<h3>The problem</h3>
<p>Safari would break the list, causing the last item to wrap, breaking the layout.</p>
<h3>The solution</h3>
<p>Simply adding <code>white-space:nowrap;</code> to the navigation container solved the issue.</p>
<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 1/10 <strong>Annoyance factor:</strong> 1/10</p>
<h2>Bug #5 &#8211; Internet explorer making content disappear a.k.a peek-a-boo bug</h2>
<p>I&rsquo;m not sure if this was the peek-a-boo bug for sure, but strangely it also happened in IE7, which is a bit of a downer considering they were supposed to fix it!</p>
<p>Anyway what happened is that sometimes when scrolling content would randomly vanish, also background images would disappear revealing the background colour of the page.</p>
<p>This bug probably took the longest to fix, simply because I hadn&rsquo;t encountered it before.</p>
<h3>The fix</h3>
<p>I found a fix by searching, and it seemed rather odd to me, but somehow it worked. It was called the holly hack, and applied a height of 1% to the box with the problem in IE, causing the background to fill the box correctly. Hoorah.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* \*/</span>
<span style="color: #00AA00;">*</span> html  .<span style="color: #993333;">block</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">1%</span><span style="color: #00AA00;">&#125;</span><span style="color: #00AA00;">;</span>
<span style="color: #808080; font-style: italic;">/* */</span></pre></td></tr></table></div>

<p>Note that the rule after this hack can be ignored, so it is best to insert a dummy rule afterwards e.g. *{margin:0;}.</p>
<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 6/10 <strong>Annoyance factor:</strong> 10/10</p>
<h2>Bug #6 &#8211; Image/background image positioning bug</h2>
<p>My banner image is actually two images, one background (the sunburst), and the logo. The logo is just inserted inside a div<br />
with padding to make it taller. It also has a background image using the css:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#557799</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/burst.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">;</span></pre></td></tr></table></div>

<p>In firefox the image lines up perfectly, however IE looks like the background image is not aligned to the bottom left perfectly, and is shifted slightly.</p>
<h3>The fix</h3>
<p>By adding a conditional comment to add negative margins to my logo, I can line the image up manually so it works in both browsers.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if IE]&gt;
    &lt;style&gt;
      #header img{position:relative;margin-bottom:-4px;}
    &lt;/style&gt;
&lt;![endif]--&gt;</pre></td></tr></table></div>

<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 5/10 <strong>Annoyance factor:</strong> 7/10</p>
<h2>Bug #7 &#8211; Doubled margins bug</h2>
<p>If you are a coder there&rsquo;s a 99% chance you have encountered this bug before.</p>
<p>For some reason IE doubles the margins of floated elements, this is do to a bug in the engine.</p>
<h3>The fix</h3>
<p>This ones easy, just add <strong>display:inline</strong> to the floated element!</p>
<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 1/10 <strong>Annoyance factor:</strong> 2/10</p>
<h2>Bug #8 &#8211; Box model</h2>
<p>Like the above bug, this is probably the most common IE bugs encountered due to the fact IE 5 renders the box model differently to standards based browsers.</p>
<p>To put it simply, standards browsers render the width of a div with the width + the padding, whereas IE 5 renders the width of a div with the set width &#8211; the padding.</p>
<p>So for standards browsers, if you wanted a box 200px wide with a 10px padding left and right, you would set:</p>
<p>width: 180px; padding:10px;</p>
<p>But IE would show the box just as 180px wide, not 200px (width + padding).</p>
<h3>The solution</h3>
<p>There are many solutions to this common problem, such as conditional comments again. However I chose to use a simple box model hack to fix this problem. The code for the hack looks like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> html <span style="color: #cc00cc;">#box</span>
<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
  w\idth<span style="color: #00AA00;">:</span> <span style="color: #933;">180px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>The * html makes this rule visible to <em>only</em> Internet Explorer. However this is not enough since the rules contained would be visible to <em>all</em> versions of IE, including IE 6 which doesn&rsquo;t have the problem. This is where the backslash comes into play. The code with the backslash rule is <em>not seen</em> by IE 5, but is by IE 6, meaning we can set the value for old versions, then reset for IE6.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> html <span style="color: #cc00cc;">#box</span> <span style="color: #808080; font-style: italic;">/*Rules for IE only*/</span>
<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">260px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*rule for IE 5 and below*/</span>
  w\idth<span style="color: #00AA00;">:</span> <span style="color: #933;">228px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*Rule for IE 6*/</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 4/10 <strong>Annoyance factor:</strong> 8/10</p>
<h2>Bug #9 &#8211; Inline list of items</h2>
<p>This one drove me mad, I found this later on in testing IE 6, when I thought I was done.</p>
<p>It seemed that my list for post options (read more, comments, digg etc) would wrap partly around, leaving behind the background items and half the text.</p>
<p>The icons were done by adding a background image to the span of text, with a padding-left. This was to make the icon centred next to the text correctly.</p>
<p>To fix this I tried white-space:nowrap to the spans, this stopped the text from breaking up, but still left the icon behind. I think this was do to the padding staying where the box wrapped from, and not from its new position.</p>
<p>The fix? I ended up having to surround the spans with the background image icons, with a second span that had position:relative; so that the padding of the contained span would be relative to the new position. I called the outer span &#8216;wrapper&#8217;.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">.wrapper<span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span><span style="color: #993333;">nowrap</span><span style="color: #00AA00;">;</span>  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<h3><span class="strike">Bug conclusion</span></h3>
<p><span class="strike"><strong>Difficulty rating:</strong> 7/10</span> <span class="strike"><strong>Annoyance factor:</strong> 9/10</span></p>
<h3>Complications of my fix</h3>
<p>It seems that, whilst working in IE 6, this fix made my icons overlap the text in IE 5/5.5, so to rectify this I added a conditional comment that targets IE 5 only, to give the span with the image a large width, making it display without overlap. It doesent look the same, however it makes it useable so is a good solution.</p>
<p>The code below is what i used, note the &#8216;lte&#8217; before the version of IE, this means &#8216;less than or equal to&#8217;.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if lte IE 5.5000]&gt;
      &lt;style&gt;
        .moretext{padding-left:32px;width:200px;}
     &lt;/style&gt;
&lt;![endif]--&gt;</pre></td></tr></table></div>

<h3>Bug conclusion</h3>
<p><strong>Difficulty rating:</strong> 8/10 <strong>Annoyance factor:</strong> 10/10</p>
<p>And so you have it, if you took the time to read this you will understand why it was all so frustrating, but in the end it was worth it.</p>
<p>If you have any improved solutions to any of these bugs, or your own bugs and solutions, feel free to post them as a comment,<br />
I&rsquo;m always willing to learn from others!</p>
<p>If you spot any bugs feel free to tell me, just note it may make my head implode!</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/my-day-of-buggy-hell-with-ie-a-css-story/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Web design tools listings</title>
		<link>http://blue-anvil.com/archives/web-design-tools-listings/</link>
		<comments>http://blue-anvil.com/archives/web-design-tools-listings/#comments</comments>
		<pubDate>Mon, 26 Jun 2006 13:41:07 +0000</pubDate>
		<dc:creator>Mike Jolley</dc:creator>
				<category><![CDATA[Web design Tools]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://82.110.105.91/blue-anvil.co.uk/?p=12</guid>
		<description><![CDATA[This article has a wealth of links to web design tools and utilities you WILL find useful. These are tools I have found, and use myself, not ones I have created! All these tools run in the browser, and don’t require you to download any files. Colour scheme tools Online color scheme generator 2 http://wellstyled.com/tools/colorscheme2/index-en.html [...]]]></description>
			<content:encoded><![CDATA[<p>This article has a wealth of links to web design tools and utilities you WILL find useful. These are tools I have found, and use myself, not ones I have created! All these tools run in the browser, and don’t require you to download any files.</p>
<p><span id="more-12"></span></p>
<h2>Colour scheme tools</h2>
<h3>Online color scheme generator 2</h3>
<p><a href="http://wellstyled.com/tools/colorscheme2/index-en.html" class="link"> http://wellstyled.com/tools/colorscheme2/index-en.html</a></p>
<p>This is a wonderful tool you can use to make your own colour schemes. You can set up a scheme based on different models (e.g complements, see my <a href="http://www.blue-anvil.com/blogarticles.php?subaction=showfull&#038;id=1149083171&#038;archive=&#038;start_from=&#038;ucat=2&#038;" class="link"> colour schemes article</a>).<br />
Another great feature is that you can see your scheme from the perspective of people with colour disabilities; this aids you in finding a scheme that is accessible! </p>
<h3>Color Schemer online</h3>
<p><a href="http://www.colorschemer.com/online.html" class="link"> http://www.colorschemer.com/online.html</a></p>
<p>Not as feature packed as ‘color scheme tools’, but can help convert colors from RGB and hex, and shows colors that fit with the selected color. </p>
<h2>CSS tools</h2>
<h3>Flumpcakes css optimiser</h3>
<p><a href="http://flumpcakes.co.uk/css/optimiser/" class="link"> http://flumpcakes.co.uk/css/optimiser/</a></p>
<p>Excellent online tool for optimising and tidying up your CSS files. You simply plug in your css file, and it outputs a cleaner version, and also displays the amount it has cleaned up so you can compare file sizes. The only drawback is that it will remove any hacks you have added to your css file.</p>
<h2>Validation</h2>
<h3>W3C CSS Validator</h3>
<p><a href="http://jigsaw.w3.org/css-validator/" class="link">http://jigsaw.w3.org/css-validator/</a></p>
<p>This is the bog standard css validator from the W3C. Make sure your code validates, then you can also have a little icon to put on your site to show this!</p>
<h3>W3C HTML validator</h3>
<p><a href="http://validator.w3.org/" class="link">http://validator.w3.org/</a></p>
<p>Probably the most useful tool in this listing. Allows you to validate your html code. This is essential for making sure the page will render right, and clearing out bugs.</p>
<h3>WDG HTML validator</h3>
<p><a href="http://www.htmlhelp.com/tools/validator/" class="link"> http://www.htmlhelp.com/tools/validator/</a></p>
<p>Very similar to the W3C validator.</p>
<h3>FEED validator</h3>
<p><a href="http://feedvalidator.org/" class="link">http://feedvalidator.org/</a></p>
<p>Validate your RSS feeds to ensure users will have no problems viewing them..</p>
<h2>Accessibility checkers</h2>
<h3>Watchfire</h3>
<p><a href="http://webxact.watchfire.com/" class="link"> http://webxact.watchfire.com</a></p>
<p>Validate your WebPages and highlights flaws with the accessibility.</p>
<h2>Compatibility testing</h2>
<h3>Safari test</h3>
<p><a href=http://www.snugtech.com/safaritest/ class="link"> http://www.snugtech.com/safaritest/</a></p>
<p>Great tool for testing Mac compatibility. You just add your site url, and the tester renders an image of your site in safari, showing you want mac browsers will see. This tool is also useful for generating full screen page screenshots!</p>
<h2>Misc tools</h2>
<h3>Button maker</h3>
<p><a href="http://kalsey.com/tools/buttonmaker/" class="link"> http://kalsey.com/tools/buttonmaker/</a></p>
<p>This tool allows you to create cool little buttons for your site. You can customise the text and colours and output to a file.</p>
<h3>Web 2.0 validator</h3>
<p><a href="http://web2.0validator.com/" class="link"> http://web2.0validator.com/</a></p>
<p>This tool allows you to check how web 2.0 your site is!. Quite entertaining to see the results.</p>
]]></content:encoded>
			<wfw:commentRss>http://blue-anvil.com/archives/web-design-tools-listings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

