<?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>The Bright Lines &#187; HTML</title>
	<atom:link href="http://www.thebrightlines.com/category/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thebrightlines.com</link>
	<description>HTML, CSS, Javascript and more</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:00:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Considerations on building a frontend codebase</title>
		<link>http://www.thebrightlines.com/2011/09/22/considerations-on-building-a-frontend-template-in-html-css-and-javascript/</link>
		<comments>http://www.thebrightlines.com/2011/09/22/considerations-on-building-a-frontend-template-in-html-css-and-javascript/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 20:46:34 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Web development in general]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=933</guid>
		<description><![CDATA[This article is about my thoughts on how to build a solid codebase for your (frontend) web development.]]></description>
			<content:encoded><![CDATA[<p>Every developer at one time stops looking for code from previous built websites and starts building his own standardized code to cut down on production time and repetative work. Call it a boiler plate, codebase, template, scaffolding, framework or whatever. The bottom line is that every developer needs one.</p>
<h2>Problems with my current codebase</h2>
<p>Well, I already have a codebase, but it has some problems. The important one is that it only covers the very basics. That&#8217;s because designs can be very diverse and as a developer I want to stay true to the design. So it&#8217;s hard to build a codebase with grids and blocks if all design differ from eachother.</p>
<p>Another problem major issue is something I have more control over: the codebase and the documentation is a bit scattered. The last problem I have is that I have no demo page of my standard CSS code, so there&#8217;s no easy way to check the template on browser compatibilities.</p>
<p>Now my <a href="/onopager/website/">jQuery plugin project</a> has reached version 1.1, I had the time to do some thinking about a new codebase that would be solid, extendable, easy to deploy and would replace all other codebases and documentation.</p>
<p>Let me make it clear: this article is about my considerations about building a solid framework for myself. It may not apply to you and my ideas not unique either. It still may be helpful for you to get an idea of what sort of codebase you need.</p>
<h2>Existing examples</h2>
<p>The most important thing about a codebase is to decide how to set it up and how to store it. I like the way open source grids like <a href="http://960.gs/">Grid960</a> and <a  href="http://developer.yahoo.com/yui/grids/">YUI</a> have organized their code into little reusable bits and have created a demo and test page for each and every component.</p>
<p>I must admit: I hardly ever used these grids. Most of those grids talk the language of the web developer, not of the designer. And the designers I know don&#8217;t have to limit themselves to a 24-column grid system. Not to mention the designers that are totally ignorant of such a system and whose task is to design a website and mail the Photoshop file to some other company that has to build it. Although I have my reservations towards grids, I like the way these codebases are organized. It can serve as a good <a href="http://www.blueprintcss.org/">Blueprint</a> for my own codebase.</p>
<p>I also get my inspiration from Nicole Sullivan&#8217;s talk on Object Oriented CSS (OOCSS). OOCSS basically means that you build your components in such a way that they become extendable objects. Just like in real object oriented programming. Just have a look at <a href="http://www.stubbornella.org/content/2009/03/23/object-oriented-css-video-on-ydn/">her talk about OOCSS on Yahoo! Developer Network</a>.</p>
<h2>Prefix classes</h2>
<p>By adding a (relatively) unique string before the name of the class you have created your own CSS namespace. It will minimize any interference of other CSS styling that is not part of your own code. Some real life examples can be found in the code that is generated by the CMS systems I have experience with: <a href="http://www.sitefinity.com">Sitefinity</a> and <a href="http://www.sitecore.com">Sitecore</a>. The CMS Sitefinity for example prefixes all CSS classes with &#8220;sf_&#8221;.</p>
<h2>Grids, blocks and text</h2>
<p>All CSS code will be split into different categories that work relatively independently of each other. Until now I can come up with 3 of them.</p>
<h3>Grids</h3>
<p>Grids are the frameworks of placeholders in which we put our content. You know: header, visual, column1, column2, column3 and footer. There are lots of grid templates around like <a href="http://960.gs/">Grid960</a> and <a href="http://www.blueprintcss.org/">Blueprint</a>. My view is that those templates only work if the designer agrees to work within the limits of that framework. My ambition is to write a framework that makes my work easier while still being flexible enough to keep the designers happy.</p>
<h3>Blocks</h3>
<p>There are as many block as the designer can come up with. I think it will be a real time saver to talk with the designer and write down all the types of blocks he thinks he&#8217;ll like to use often. Or even better: just open the last 20 or so web designs he/she made and destil the common blocks and its common features. like menus, news article lists, homepage spotlights, etc. Finally you create basic blocks of it in your template system.</p>
<p>Standarization is not always popular with designers but if it means that projects can be created cheaper there may eventually be budget left to build cool stuff. At least, I hope&#8230;</p>
<h3>Text</h3>
<p>Basic text styling is also a relatively independent component in CSS code. You always define a basic font color, family, size and line height that serves as a base styling for the whole websites. More specific text styling in blocks should be kept to a minimum and preferably relatively to the base text style. So if you have a base style of <code>font: 1em/1.5em normal Arial, sans-serif</code>, you ideally should style a header in a block like this: <code>font-size: 1.5em; line-height: 1.2em;</code>.</p>
<p>Although <code>font-weight</code> is not something you can set relative to a base style, it&#8217;s not likely that it will look ugly in combination with some design if you add <code>font-weight</code> styling to a block. Setting the <code>font-family</code> in the styling of blocks on the other hand will most likely interfere with design, since designs tend to depend heavily on a particular font.</p>
<h2>Create base templates and extend themes</h2>
<p>The code for each grid system and each block will be stored in a seperate base CSS file. Each grid or block can be extended with extra themes or styles. Each style extension will have its own CSS file and presumes that the base file is already loaded.</p>
<h2>Optimizing CSS</h2>
<p>Having all code seperated in small snippets is great for maintaining an overview. As long as you can see what a CSS file does by looking at its filename, its will be easy to add and extend styling to a website.</p>
<p>The template code is not optimized for speed, though. If we don&#8217;t do anything about the fragmentation, the server will have to load a bunch of little CSS files. It&#8217;s important to stress this: It&#8217;s not just the total filesize that matters, each http request costs time. Check out <a href="http://developer.yahoo.com/yslow/">YSlow</a> if you want to know more about this and if it affects your site.</p>
<h3>YUI</h3>
<p>That&#8217;s why all CSS in the website has to be exported, merged and its code minified to one single CSS file. Normally I use <a href="http://developer.yahoo.com/yui/compressor/">YUI compressor</a> for it.</p>
<h3>Less</h3>
<p>But you can do more than just minification. <a href="http://lesscss.org/">Less</a> is a system that extends the CSS syntax with stuff like variables, nested rules and mixins. Less was originally built in Ruby, but there&#8217;s also an <a href="http://www.dotlesscss.org/">ASP.NET port</a>. I hope it will help me create very flexible grids.</p>
<p>By exporting CSS into optimized code, you can focus on making the most readable CSS source file because all comments and spaces in the code will be removed in the end. This is also what I do with JavaScript code and certainly will continue to do.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/12/24/too-advanced-css-selectors/' rel='bookmark' title='Permanent Link: Too advanced CSS selectors'>Too advanced CSS selectors</a></li>
<li><a href='http://www.thebrightlines.com/2011/09/08/the-last-resort-in-css-debugging/' rel='bookmark' title='Permanent Link: The last resort in CSS debugging'>The last resort in CSS debugging</a></li>
<li><a href='http://www.thebrightlines.com/2011/11/21/debugging-less-css/' rel='bookmark' title='Permanent Link: Tips for using and debugging of Less CSS code'>Tips for using and debugging of Less CSS code</a></li>
<li><a href='http://www.thebrightlines.com/2012/01/17/1028/' rel='bookmark' title='Permanent Link: Crucial stuff for your company&#8217;s internal projects'>Crucial stuff for your company&#8217;s internal projects</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2011/09/22/considerations-on-building-a-frontend-template-in-html-css-and-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Check your sites in IE9. Even if you use the X-UA meta tag</title>
		<link>http://www.thebrightlines.com/2011/03/13/check-your-sites-in-ie9-even-if-you-use-the-x-ua-meta-tag/</link>
		<comments>http://www.thebrightlines.com/2011/03/13/check-your-sites-in-ie9-even-if-you-use-the-x-ua-meta-tag/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 20:19:05 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[x-ua]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=792</guid>
		<description><![CDATA[Since IE8 you can force an IE8+ browser to handle a website like it is an IE7 or an IE8 browser. IE9 seems to emulate older browsers well, but I know at least one rendering bug and I'm wondering if some backwards compatibility bugs are overlooked.]]></description>
			<content:encoded><![CDATA[<p>The Microsoft&#8217;s X-UA meta tag is simple. Just by adding <code>&lt;meta http-equiv="X-UA-Compatible" content="IE=7" /&gt;</code> to the HEAD you can make IE8 and IE9 handle a web page like it&#8217;s IE7. That way I can support 3 browser versions but having to test only one. It saves time that otherwise would be spent on testing.</p>
<p>Though it may seem like a good idea, the X-UA tag was initially received with mixed reactions. Some worried for example that web developers will become lazy and would only support IE7 even if Microsoft would roll out IE15. John Resig (creator of jQuery) even would go as far as calling the X-UA tag, <a href="http://ejohn.org/blog/meta-madness/">&ldquo;completely useless&rdquo; and &ldquo;harmful&rdquo;</a>. He thinks that the X-UA tag will just create more confusion because there will always be differences between a native IE7 and an emulated IE7.</p>
<p>I decided to use the meta-tag anyway. If it really didn&#8217;t work at all I could always remove the meta tag. On top of it: most websites I work on are not that complex and simplifying test procedures is a big plus.</p>
<h2>My experience with the X-UA</h2>
<p>Until now I had some good experiences with the X-UA tag, but I must say I have encountered 2 differences in rendering between a native IE7 and an emulated one. That&#8217;s not much if you consider that I use it ever since the meta tag was available, but it is something we have to look out for.</p>
<p>One of those 2 bugs happened just a while ago. We noticed that some website did not render well in IE9 with IE7 emulation. The text that was styled with custom web fonts (loaded with @font-face) was chopped off at the top and bottom. There was no problem in a native IE7 browser. The bug below shows that although IE7 emulation works pretty well, it still may have some glitches.</p>
<div class="wp-caption alignnone" style="width: 354px"><img alt="The line above is a screenshot from a native IE7. The line below is from an IE9 in IE7 mode. Both run on Vista." src="/article-data/images/x-ua.png" title="Missing the top line in IE9 in IE7 emulation  " width="344" height="36" /><p class="wp-caption-text">The line above is a screenshot from a native IE7. The line below is from an IE9 in IE7 mode. Both run on Vista.</p></div>
<p>So it may be worth while to check some old websites you created when you installed <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?WT.mc_id=MSCOM_DLC_US_F_113LMUS004274">IE9</a>, <i>even</i> when you implemented the X-UA tag.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2011/03/13/check-your-sites-in-ie9-even-if-you-use-the-x-ua-meta-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Codeview, a new template for JSDoc Toolkit</title>
		<link>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/</link>
		<comments>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/#comments</comments>
		<pubDate>Thu, 06 May 2010 20:18:29 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Documentation]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[codeview]]></category>
		<category><![CDATA[jsdoc]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=605</guid>
		<description><![CDATA[I created a new HTML template for the Javascript documentation tool JSDoc, which is now free for download. It is tested in IE6 to IE9, FF3.6, Chrome 5 and Safari 4.]]></description>
			<content:encoded><![CDATA[<p><a class="button download" href="https://github.com/WouterBos/Codeview/downloads"><span> </span>Download Codeview 1.2</a></p>
<div class='clear'></div>
<p>The template is based on the basic template of <a href="http://code.google.com/p/jsdoc-toolkit/">JSDoc Toolkit</a>. The HTML structure is basically the same, but with a new design for both desktop and mobile browsers.</p>
<h2>Command line options</h2>
<ul>
<li><strong>Set title</strong> <code>-D="title:Estate Library"</code></li>
<li><strong>Remove _global_</strong> <code>-D="noGlobal:true"</code></li>
<li><strong>Make &#8220;Files&#8221; the homepage instead of &#8220;Classes&#8221;</strong> <code>-D="index:files"</code></li>
</ul>
<p>
    Example:<br />
    <code>java -jar jsdoc-toolkit\jsrun.jar jsdoc-toolkit\app\run.js -d=Documentation\ -D="noGlobal:true" -D="title:Estate Library" -D="index:files" -t=jsdoc-toolkit\templates\codeview -p -v Javascript\Estate\Source\Estate*.js</code>
</p>
<h2>Screenshots (version 1.1.2)</h2>
<div class="wp-caption alignnone" style="width: 450px"><img title="Codeview for desktops" src="/article-data/images/codeview1.1-screen.png" alt="Codeview for desktops" width="440" height="372" /><p class="wp-caption-text">Codeview for desktops</p></div>
<div class="wp-caption alignnone" style="width: 310px"><img title="Codeview for handheld devices" src="/article-data/images/codeview1.1-handheld.png" alt="Codeview for handheld devices" width="300" height="455" /><p class="wp-caption-text">Codeview for handheld devices</p></div>
<h2>Changelog:</h2>
<ul>
<li>
		<strong>1.2</strong><br />
		- Extra command line options, thanks to Aaron Wirtz<br />
		- A more logical template structure, thanks to Aaron Wirtz<br />
		- A quick filter, to filter the class list and methods<br />
		- Some bug fixes, including one reported by Gregor
	</li>
<li>
		<strong>1.1.2</strong><br />
		- Option for removing the _global_ link by adding <code>-D="noGlobal:true"</code> in the command line
	</li>
<li>
		<strong>1.1.1</strong><br />
		- Styling fixes
	</li>
<li>
		<strong>1.1</strong><br />
		- Support for mobile devices<br />
		- Updated design and styling fixes
	</li>
</ul>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/11/30/codeview-1-2/' rel='bookmark' title='Permanent Link: Codeview 1.2'>Codeview 1.2</a></li>
<li><a href='http://www.thebrightlines.com/2010/09/27/codeview-update/' rel='bookmark' title='Permanent Link: Codeview update'>Codeview update</a></li>
<li><a href='http://www.thebrightlines.com/2010/03/28/document-your-javascript-interview-with-michael-mathews-of-jsdoc/' rel='bookmark' title='Permanent Link: Document your Javascript: interview with Michael Mathews of JSDoc Toolkit'>Document your Javascript: interview with Michael Mathews of JSDoc Toolkit</a></li>
<li><a href='http://www.thebrightlines.com/2011/07/30/codeview-is-on-github-now/' rel='bookmark' title='Permanent Link: Codeview is on Github now'>Codeview is on Github now</a></li>
<li><a href='http://www.thebrightlines.com/2010/09/29/another-codeview-update/' rel='bookmark' title='Permanent Link: Another Codeview update'>Another Codeview update</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Do you create your design in Photoshop or Notepad?</title>
		<link>http://www.thebrightlines.com/2010/01/07/do-you-create-your-design-in-photoshop-or-notepad/</link>
		<comments>http://www.thebrightlines.com/2010/01/07/do-you-create-your-design-in-photoshop-or-notepad/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 23:22:14 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Photoshop]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=349</guid>
		<description><![CDATA[Do you show your client static pictures of the web design or do you code the mockup in HTML?]]></description>
			<content:encoded><![CDATA[<p>Recently Meagan Fisher published an <a href="http://24ways.org/2009/make-your-mockup-in-markup">article in which she discusses an alternative way to present a web design</a> to a client: Don&#8217;t emulate it in Photoshop, but build it in HTML and CSS. There are some advantages to it. A client can see more than just the design. He/she can also see:</p>
<ul>
<li>Behaviour of the fluid design</li>
<li>Interaction like hovers</li>
<li>How the website looks in different browsers</li>
</ul>
<p>On top of it, she also mentions some disadvantages of using Photoshop:</p>
<ul>
<li>It crashes, leaving you with hours of work lost.</li>
<li>Font rendering sucks</li>
</ul>
<h2>Photoshop is still king</h2>
<p>Although creating a website directly in HTML has it advantages, I think designing in Photoshop is better in most cases.</p>
<h3>Photoshop is faster</h3>
<p>Yes, a simple design could well be created directly in HTML. But not all designs are simple. Changing a background color is easy in CSS, but dragging columns around, changing or altering visuals and all kind of other alterations are quicker in Photoshop. Designs can change dramatically before it is finally approved by the client. Those changes are quicker done in Photoshop.</p>
<h3>Photoshop is static</h3>
<p>Being static isn&#8217;t not just a disadvantage. A static design is in fact helpful because it helps you focus on how a website should look like and not be bogged down by browser incompatibilities. This too gives you extra speed in designing.</p>
<h3>Photoshop is versatile</h3>
<p>Just because CSS can do stuff like round corners and text shadows in some browsers, doesn&#8217;t mean it has become a designing tool. Photoshop can do more than just that.  When designing in HTML I start to think too much in the constraints that both HTML and CSS have. In Photoshop I have much more design choices. Because of that I&#8217;m able to think more out of the box.</p>
<h2>Crashes and font rendering</h2>
<p>I was suprised that Photoshop crashes are mentioned as a major problem. I consider Photoshop as a very reliable product. The only problem is that saving can take a while, so not everyone saves regularly. If you don&#8217;t save regularly you&#8217;re asking for trouble. Even with stable products.</p>
<p>The issue with font rendering is indeed a problem, but that&#8217;s more an issue for designers. Clients don&#8217;t even know it&#8217;s an issue. They&#8217;ll only notice differences when they&#8217;re dramatic like with webfonts. Just compare this weblog between Apple Safari and IE on the PC: it&#8217;s hard <em>not</em> to see the difference.</p>
<h2>My preference</h2>
<p>Since I&#8217;m a web developer I ought to be tempted to skip Photoshop and start coding right away. But that&#8217;s not the case. I designed my blog twice last year. In both cases I chose to do the basic design in Photoshop. Only when I was happy with that basic design, I started developing and added extra elements on the fly. The current design of my blog could just as easy be built in HTML/CSS from the start, but I&#8217;m convinced it&#8217;s better to work in Photoshop first.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/' rel='bookmark' title='Permanent Link: Differences between Photoshop web design and HTML. Part 1: line height'>Differences between Photoshop web design and HTML. Part 1: line height</a></li>
<li><a href='http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/' rel='bookmark' title='Permanent Link: 3 Tips for making CSS sprites in Photoshop'>3 Tips for making CSS sprites in Photoshop</a></li>
<li><a href='http://www.thebrightlines.com/2011/09/03/the-grey-areas-of-progressive-enhancement/' rel='bookmark' title='Permanent Link: The grey areas of progressive enhancement'>The grey areas of progressive enhancement</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/01/07/do-you-create-your-design-in-photoshop-or-notepad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Blog redesign</title>
		<link>http://www.thebrightlines.com/2010/01/03/blog-redesign/</link>
		<comments>http://www.thebrightlines.com/2010/01/03/blog-redesign/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 23:53:27 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Web development in general]]></category>
		<category><![CDATA[Webfonts]]></category>
		<category><![CDATA[redesign]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=320</guid>
		<description><![CDATA[The Bright Lines has a new design. A short analysis of the new design.]]></description>
			<content:encoded><![CDATA[<p>The last few days I was busy redesigning the website. I was not happy with the original design.</p>
<ul>
<li>The menu on the top right was large and clunky. Because of that it didn&#8217;t leave much room for more links.</li>
<li>The &#8216;logo&#8217; on the top left did not feel like a real logo mainly because it was &#8230; well &#8230; just not designed well.</li>
<li>The shadow effect on the columns looked cool, but because it was made with PNG8 images instead of PNG24, it wasn&#8217;t possible to add an background image to the page.</li>
</ul>
<p>What I <em>did</em> like was the scalability of the website. you could as easily view the page on your (i)phone as it would be on your large, wide computer screen. I dropped support for mobile phones. There are lots of Wordpress plugins to cater the mobile devices. I have to dive into that some time. For now anyone with a mobile device can grab the <a href="http://www.thebrightlines.com/news-feeds/">RSS feeds</a>.</p>
<p>I still have to fix a few styling glitches but I thought the design was good enough to make the switch. Here are the most important aspects of the design:</p>
<ul>
<li>Use of <code>rgba</code> as background color. This makes it possible to set opacity for just the background instead of the whole box. <code>rgba</code> is not supported in IE, so you will have a solid white background then.</li>
<li>Using opacity in the columns makes it possible to use large backgrounds. That gives me a reason to pick up my photography.</li>
<li>The use of webfonts. This was something I was eager to use. This is something designers and web developers alike have been waiting for. The implementation isn&#8217;t perfect, but it looks well in Firefox and on the Apple. IE and Webkit on the PC still need some tweaking. I&#8217;ll go in to more detail in an upcoming article. For now I&#8217;ve been glad to be able to experiment with a real web site instead of running some tests with webfonts.</li>
<li>Less data: I removed irrelevant data where I could. It&#8217;s most apparent in the list of articles on the homepage where I removed information like categories, tags and dates.</li>
<li>Links become visible with an underline when a column is <code>hover</code>ed. This will make the website look less crowded. It&#8217;s a bit like the folder tree view in Vista&#8217;s Windows Explorer: you will only see the folding icons (the plus and minus icons next to the folders) when that section is active.</li>
</ul>
<p>There are some things I have to do:</p>
<ul>
<li>Make a logo that is suitable for creating a favicon</li>
<li>Tweaking the fonts for IE &amp; Webkit on PC.</li>
</ul>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/01/03/blog-redesign/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differences between Photoshop web design and HTML. Part 1: line height</title>
		<link>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/</link>
		<comments>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 00:41:15 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[first-child]]></category>
		<category><![CDATA[line-height]]></category>
		<category><![CDATA[paragraph]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=293</guid>
		<description><![CDATA[Discusses the different effects when setting the line-height in Photoshop and in HTML. It's something to keep in mind when converting PSD to HTML/CSS.]]></description>
			<content:encoded><![CDATA[<p>Photoshop is *the* tool for designing websites. To illustrate its popularity: In my 10 years in web development I hardly encountered anything else. Attempts to design websites in line drawings always failed. In those few cases a design firm did sent their webdesign in Illustrator or PDF, it would have a fair chance of being converted to Photoshop by hand before any HTML was written.</p>
<p>But like anything Photoshop has its weak points. And since we humans tend to focus on those tiny grains of imperfections I decided to sum up the troubles you can encounter when converting a Photoshop document into to a real website.</p>
<h2>Line height between paragraphs</h2>
<p>One thing that definitely can be confusing is the line height of text. When increasing the line height in Photoshop by setting the &#8216;leading&#8217;, the extra space is added <em>above</em> the text. In HTML That extra space is distributed <em>above and below</em> the text. Below you can see the differences next to each other.</p>
<div class="wp-caption alignleft" style="width: 167px"><img title="A large line-height in Photoshop adds space above the text" src="/article-data/images/Photoshop-1.png" alt="A large line-height in Photoshop adds space above the text" width="157" height="103" /><p class="wp-caption-text">A large line-height in Photoshop adds space above the text</p></div>
<div class="wp-caption alignleft" style="width: 167px"><img title="A large line-height in HTML/CSS adds space above and below the text" src="/article-data/images/Photoshop-2.png" alt="A large line-height in HTML/CSS adds space above and below the text" width="157" height="103" /><p class="wp-caption-text">A large line-height in HTML/CSS adds space above and below the text</p></div>
<div class="wp-caption alignleft" style="width: 223px"><img title="Activate this window in the menu throught Window &gt; Character" src="/article-data/images/Photoshop-3.png" alt="Activate this window in the menu throught Window &gt; Character" width="213" height="214" /><p class="wp-caption-text">Activate this window in the menu throught Window &gt; Character</p></div>
<p>Many designers use line-height to create paragraphs. So if you want to know how much margin you have to set on paragraphs, you have to look at line-height of the first line in a paragraph. In short: <strong>Line-height of the first line &#8211; default line-height = the margin between paragraphs</strong>. That&#8217;s why I never look at the line height of the first line of text in a paragraph in Photoshop.</p>
<h2>Line height of the first line in a text box</h2>
<p>Another thing to be aware of is that the line-height has <em>absolutely no effect in the first line of a text box</em>. So it doesn&#8217;t matter if you set the line-height to 20px or 40px. No extra white space is added on top of the text. HTML does not follow Photoshop&#8217;s behaviour.</p>
<p>Because of that you have to be aware that different styles with different line heights in a website can push the whole text box up or down. That&#8217;s especially important when the first line of a text box should align with some box or image on the left or right as you can see in the examples below.</p>
<div class="wp-caption alignleft" style="width: 260px"><img title="The solid box and text box are aligned (line-height: 20px)." src="/article-data/images/Photoshop-4.png" alt="The solid box and the text box are aligned (line-height: 20px)." width="250" height="105" /><p class="wp-caption-text">The solid box and the text box are aligned (line-height: 20px).</p></div>
<div class="wp-caption alignleft" style="width: 260px"><img title="...but when a heading is added with 40px line-height it does not align anymore." src="/article-data/images/Photoshop-5.png" alt="...but when a heading is added with 40px line-height it does not align anymore." width="250" height="105" /><p class="wp-caption-text">...but when a heading is added with 40px line-height it does not align anymore.</p></div>
<p>You could fix the problem above with this CSS:</p>
<pre class="css:nogutter">.textBox h1:first-child {
    margin-top: -10px; /* only half of the extra line-height has to be compensated */
    font-size: 20px;
    line-height: 40px;
}</pre>
<p>The <code>first-child</code> selector ensures us that the negative margin is only used on something that&#8217;s on the very top of the text-box. As already said, the line-height is distributed above and below the text. So we only have to compensate for the extra space on the upper part of the line. So:</p>
<p><strong>40px</strong> (line-height) <strong>- 20px</strong> (font-size) <strong>= 10px</strong> (the value for our negative top margin).</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/01/07/do-you-create-your-design-in-photoshop-or-notepad/' rel='bookmark' title='Permanent Link: Do you create your design in Photoshop or Notepad?'>Do you create your design in Photoshop or Notepad?</a></li>
<li><a href='http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/' rel='bookmark' title='Permanent Link: 3 Tips for making CSS sprites in Photoshop'>3 Tips for making CSS sprites in Photoshop</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Too advanced CSS selectors</title>
		<link>http://www.thebrightlines.com/2009/12/24/too-advanced-css-selectors/</link>
		<comments>http://www.thebrightlines.com/2009/12/24/too-advanced-css-selectors/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 22:27:05 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=273</guid>
		<description><![CDATA[CSS offers lots of different selectors, but sometimes it's better not to use them.]]></description>
			<content:encoded><![CDATA[<p>A few years ago the only reasonable way to select an element through CSS was by using classes and/or tag names. If you wanted to target a specific element, you had to select it by using its classname. Selecting elements with tag names wasn&#8217;t always practicle. For example: if you use the selector <code>div.container div</code>, you style all <code>div</code> elements inside the <code>div.container</code>.</p>
<p>Most of the time that&#8217;s not what you want. Using tag names as selectors can also make design changes troublesome if you have to add more <code>div</code>s and need to give it a different styling. But since IE7 we can use new selectors that help us to build much more delicate CSS selectors. Those new selectors are:</p>
<ul>
<li>Child selector: <code>.parent &gt; .child</code></li>
<li>First child selector: <code>.parent .child:first-child</code></li>
<li>Adjacent selector: <code>.sibling + .sibling</code></li>
<li>First child selector: <code>div:first-child</code></li>
<li>Attribute selectors: <code>div[id]</code></li>
</ul>
<p>Now you can style the following HTML with just a single class:</p>
<h3>HTML:</h3>
<pre name="code" class="xhtml:nogutter">
<div class='container'>
	<span>This is some title</span>
	<a href="#">Lorem ipsum</a>
	<a href="#">Lorem ipsum</a>
	<a href="#">Lorem ipsum</a>
	<span>Some body text with lots of <span>lorem <span>ipsums</span></span> in it</span>
	<span>Some body text with lots of <span>lorem <span>ipsums</span></span> in it</span>
	<a href="#">Lorem ipsum</a>
</div>
</pre>
<h3>CSS:</h3>
<pre name="code" class="css:nogutter">
.container span {
	font-family: sans-serif;
}
.container > span:first-child {
	font-size: 1.5em;
	font-weight: bold;
	font-family: serif;
}
.container > span > span {
	font-style: italic;
}
.container > span > span > span {
	font-weight: bold;
}
.container > span + span {
	display: block;
	margin-top: 0.5em;
}
.container a:nth-child(2) {
	font-weight: bold;
}
.container a {
	display: block;
	color: #f0f;
}
.container a:nth-child(4) ~ a {
	font-size: 0.9em;
}
</pre>
<p>The advantage is that you can, as you can see, style whole blocks of HTML code with just one class. In theory you could even use no classes at all. Without &#8216;class&#8217;-attributes on every element, the HTML code looks just a little bit more cleaner and readable. You can also use those and other selectors in javascript libraries like jQuery to select particular HTML elements. Since most libraries are cross-browser you don&#8217;t have to worry if a selector is or isn&#8217;t supported by a browser. Consider this piece of code in jQuery:</p>
<pre name="code" class="javascript:nogutter">
jQuery(".container a:nth-child(4) ~ a").click( function() {
	alert('hello world');
})
</pre>
<h2>That&#8217;s all nice, but should I use it?</h2>
<p>No. I use them some times, but I try to stay away from it if possible. The problem with these selectors is that they rely so much on the structure of the HTML that it becomes harder to change the HTML structure. If you take another look at the HTML and CSS that I showed as an example in the beginning of the article, it&#8217;s clear that you can&#8217;t add a few links or spans without having to change the CSS. Add some advanced jQuery selectors in the mix and you may have locked the HTML structure forever since no-one dares to change it.</p>
<h2>Should I discard those new selectors then?</h2>
<p>Not necessarily. Sometimes you just have no choice if you for some reason are not able to change the HTML. My personal guideline is that styling has to be predictable. So when you edit some piece of HTML code, the styling should behave as expected. That means that you don&#8217;t style your HTML in a way that the text-color of the 4th <code>span</code> is red.</p>
<p>So what can be styled predictable? If you ask me advanced selectors shine when the structure is relatively fixed. Lists are a good example. Just take a look at these code blocks below. The styling will behave normal, regardless what you do with the HTML.</p>
<h3>HTML:</h3>
<pre name="code" class="xhtml:nogutter">
<ul class="list">
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor
<ul>
<li>Sit</li>
<li>Amet</li>
</ul>
</ul>
</pre>
<h3>CSS:</h3>
<pre name="code" class="css:nogutter">
ul.list li + li {
	margin-top: 10px; /* adds top margin to all list items except the first */
}
ul.list > li {
	font-weight: bold; /* styles only the first level list items differently */
}
</pre>
<h3>Javascript:</h3>
<pre name="code" class="javascript:nogutter">
jQuery("ul.list li:nth-child(even)").addClass("zebra"); // adds zebra striping to a list
</pre>
<h2>HTML elements you can easily apply advanced selectors</h2>
<p>Besides <code>ul</code>, you can style <code>ul</code>s, <code>dl</code>s, <code>table</code>s. That doesn&#8217;t mean that other elements should only be styled with classes. There are always some exceptions to the rule. Just let your common sense be the judge.</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/11/08/how-to-overcome-the-limits-of-css-in-internet-explorer-6/' rel='bookmark' title='Permanent Link: How to overcome the limits of CSS in Internet Explorer 6'>How to overcome the limits of CSS in Internet Explorer 6</a></li>
<li><a href='http://www.thebrightlines.com/2009/10/28/for-the-sloppy-clickers/' rel='bookmark' title='Permanent Link: For the sloppy clickers'>For the sloppy clickers</a></li>
<li><a href='http://www.thebrightlines.com/2010/01/31/hack-how-to-enable-first-child-in-ie6/' rel='bookmark' title='Permanent Link: Hack: how to enable :first-child in IE6'>Hack: how to enable :first-child in IE6</a></li>
<li><a href='http://www.thebrightlines.com/2010/01/04/alternative-for-nth-of-type-and-nth-child/' rel='bookmark' title='Permanent Link: Alternative for :nth-of-type() and :nth-child()'>Alternative for :nth-of-type() and :nth-child()</a></li>
<li><a href='http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/' rel='bookmark' title='Permanent Link: What you can&#8217;t do in IE&#8217;s Quirks Mode'>What you can&#8217;t do in IE&#8217;s Quirks Mode</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/12/24/too-advanced-css-selectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What you can&#8217;t do in IE&#8217;s Quirks Mode</title>
		<link>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/</link>
		<comments>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 23:00:26 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=146</guid>
		<description><![CDATA[If you're accustomed to make websites by following the W3C guidelines, you'll be suprised what you can't do in IE when you have to work on a site that runs in IE's Quirks Mode (at least I was).]]></description>
			<content:encoded><![CDATA[<p>As most of you probably know IE can render websites in either Quirks Mode or Standards Compliant Mode. Standards Mode is the mode that is most compatible with other browsers like Firefox, while Quirks Mode exists for backwards compatibility purposes. IE automatically chooses one of these modes by looking at the first line of the HTML code. Check out <a href="http://www.quirksmode.org/css/quirksmode.html">Quirksmode.org</a> and <a href="http://en.wikipedia.org/wiki/Quirks_mode">Wikipedia</a> if you want to know more about both modes and how to trigger them. But in case you want the short summary: if you don&#8217;t start your document with a DTD like the example below, IE will render the website in Quirks Mode.</p>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</code></p>
<p>I only build websites in Standards Mode, so Quirks Mode is an almost non-existent issue for me. This week, however, I had to restyle an old website. And while rewriting the CSS I remembered that the difference between the two modes goes farther than just a difference in <a href="http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug">box model</a>. Simple things you&#8217;ve learned to rely on in Standards Mode are gone in Quirks Mode.</p>
<h2>No <code>* html</code></h2>
<p>If I want a class to specifically target IE6 or IE7 I always prepend selectors with <code>* html</code> (IE6) or <code>*:first-child+html</code> (IE7) in case the rendering is a bit off with other browsers. But that simply doesn&#8217;t work in Quirks Mode. On Wikipedia there&#8217;s a <a href="http://en.wikipedia.org/wiki/CSS_filter">list of browser bugs you can exploit in CSS</a>. I chose to exploit the &rdquo;<code>!important</code> quirk&ldquo; since future browsers will just ignore the invalid CSS code that only runs in IE6 and IE7.</p>
<p>To use the &rdquo;<code>!important</code> quirk&ldquo; you misuse the <code>!important</code> keyword. Normally that keyword is used like this:</p>
<pre name="code" class="css:nogutter">
.classname {
    width: 100px !important;
}
</pre>
<p>The <code>!important</code> keyword ensures that the width of 100px cannot be overruled by other styles unless you use another <code>!important</code>. In IE6 and IE7 any keyword that starts with a <code>!</code> works like a <code>!important</code>, so you can write something like this:</p>
<pre name="code" class="css:nogutter">
.classname {
    width: 100px; /* works in all 'normal' browsers' */
    width: 150px !lteIE7; /* for IE 7 and lower */
}
</pre>
<h2>No fancy selectors</h2>
<p>What surprised me much more is that some advanced selectors like the attribute selectors are not possible in IE7 when running in Quirks Mode. So the CSS code below will only work in Standards Mode:</p>
<pre name="code" class="css:nogutter">
table[width='160'] { /* this selector will not run in IE7 Quirks Mode */
    width: 100px;
}
</pre>
<p>The same holds true for selectors like <code>:first-child</code>, the Adjacent Sibling (<code>+</code>) Combinator and the Child (<code>&gt;</code>) Combinator. Bummer.</p>
<h2>Why not use conditional comments?</h2>
<p>If you want to have some classes that are specifically targeted towards IE6 and IE7, Conditional Comments are the easiest and safest thing.</p>
<p><code>&lt;!--[if lt IE 6]&gt;<br />
&lt;link href='/css/IE6.css' rel='stylesheet' type='text/css' media='all' /&gt;<br />
&lt;![endif]--&gt;<br />
</code></p>
<p>But I prefer CSS filters above conditional comments. By using CSS filters I have all the styling of an element in one page and not scattered around in different CSS files. In most cases I only use conditional comments to hide CSS code that won&#8217;t validate.</p>
<p><a href="/conditional-comments/">More information about conditional comments</a></p>
<p><span style="font-size: 0.8em">Code for the sake of Technorati: 4252WKT38H9D</span></p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/12/24/too-advanced-css-selectors/' rel='bookmark' title='Permanent Link: Too advanced CSS selectors'>Too advanced CSS selectors</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clean up source code fast</title>
		<link>http://www.thebrightlines.com/2009/11/09/clean-up-source-code-fast/</link>
		<comments>http://www.thebrightlines.com/2009/11/09/clean-up-source-code-fast/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 19:10:06 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[formatting]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=128</guid>
		<description><![CDATA[How to transform incomprehensible HTML code into something nicely formatted and readable.]]></description>
			<content:encoded><![CDATA[<p>Sometimes you just have nothing more than the HTML that your browser gives you when you view the page source. And depending on the level of server side programming the parsed HTML code either looks ordered and readable or like a string of random characters. You can try to format it yourself but there are lots of ways to format HTML code automatically. Here are the ones I use:</p>
<ul>
<li><strong>Dreamweaver</strong> In your menu go to: <code>Commands > Clean Up HTML</code>.</li>
<li><strong>Visual Studio</strong> Select the source code in the editor, right click on the selected code and choose <code>Format selection</code>. Here&#8217;s <a href="http://weblogs.asp.net/scottgu/archive/2006/07/07/Tip_2F00_Trick_3A00_-Custom-formatting-HTML-in-Visual-Web-Developer-and-Visual-Studio-2005.aspx">a nice article from Scott Guthrie that also explains how to configure the source formatting</a>.</li>
<li><strong>HTML Tidy</strong> If could probably list a plethora of programs that (also) do formatting, but I&#8217;ll only mention HTML Tidy since I occasionally use the online version of it on <a href="http://infohound.net/tidy/">HTML Tidy Online</a>.</li>
</ul>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2011/11/21/debugging-less-css/' rel='bookmark' title='Permanent Link: Tips for using and debugging of Less CSS code'>Tips for using and debugging of Less CSS code</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/11/09/clean-up-source-code-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 Tips for making CSS sprites in Photoshop</title>
		<link>http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/</link>
		<comments>http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 06:30:18 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[CSS sprites]]></category>
		<category><![CDATA[Photoshop]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=91</guid>
		<description><![CDATA[Some tips for making CSS sprites in Photoshop: using a grid, how to handle bullets and how to export.]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago Chris Coyier <a href="http://css-tricks.com/css-sprites/">discussed CSS sprites on his blog</a>. The article nicely explains why some people use this technique to speed up their website. It refers to a called <a href="http://spriteme.org/">SpriteMe</a> for creating sprites. What I missed were some tips you could in Photoshop when creating CSS sprites. I missed:</p>
<ul>
<li>Using a grid</li>
<li>Some info about exporting</li>
<li>How to use bullets in CSS sprites</li>
</ul>
<h2>The grid</h2>
<p>One of the things that make CSS sprites hard is to figure out what coordinates you have use to show the right image in the sprite. To keep things simple I always switch on the grid: <code>Ctrl+'</code>. If needed I configure the grid to 50 pixels per line by doing the following: <code>Ctrl+K</code>, select &#8220;Guides, grid &amp; slices&#8221; and set the gridline value to 50. Finally I press <code>Ctrl+Shift+;</code> to make objects snap to the gridlines. Now you will have something like this:</p>
<p><img src="/article-data/images/css-sprites-1.png" alt="A 50 pixel grid in Photoshop" /></p>
<p>Now you can fill it with whatever you want. Because everything snaps on the 50 pixel grid it&#8217;s easy to find out what coordinate you have to use. For example: if you position the cursor to the upper left corner of the image you&#8217;d like to use (like in the screenshot below), you&#8217;ll find your coordinates in the info pane. It will be off by a few pixels but since it&#8217;s on a grid you know that you just have to round of the numbers. In this example the CSS code would be <code>background: url(sprite.png) -200px -50px no-repeat</code>.</p>
<p><img class="alignleft" style="margin-right: 10px;" src="/article-data/images/css-sprites-2.png" alt="Finding out the coordinates of a CSS sprite in Photoshop" /> <img class="alignleft" src="/article-data/images/css-sprites-3.png" alt="The coordinates in the info pane" /></p>
<div class="clear"></div>
<h2>Exporting the CSS sprite</h2>
<p>I always export a CSS sprite as PNG8. On rare occasions I do JPG to create an onmouseover-effect on picture. If you don&#8217;t have to support IE6 you might consider using PNG24 instead since it supports full color. But if you do have to support IE6 you&#8217;re stuck with PNG8 because IE6 cannot handle the alpha channels of PNG24. You could use IE&#8217;s proprietary <code>filter</code>, but that doesn&#8217;t work that well with CSS sprites since it doesn&#8217;t have an option to position a background.</p>
<p>Since PNG8 has a maximum of 256 different colors, the exported image may look bad if you need much more than that. Be wary of sprites with different colors and gradients. They may need much more than 256 colors. If you need much more colors than PNG8 can offer you, you could split the sprite by grouping the colors in different sprites. For example: you&#8217;d create one sprite for all red items and one for all the blue items.</p>
<h2>Lists and sprites</h2>
<p>Normally you use a sprite in a box that has a specific width and height. Otherwise some other image in the sprite might pop up. So sprites aren&#8217;t usable in blocks with dynamic heights like <code>p</code> tags. But there&#8217;s one exception: list items. Because bullets in a list are always aligned in the top left corner you just have to be sure that there&#8217;s no image on the right or the bottom of the bullet. So if you align the bullets from the left bottom to the upper right like in the example below you will never have images popping up in places they shouldn&#8217;t be. The left side and upper side of the line of bullets can still be used to place images while the bottom and the right has to be clear at all times.</p>
<p><img src="/article-data/images/css-sprites-4.png" alt="Bulleted items in a sprite" /></p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/' rel='bookmark' title='Permanent Link: Differences between Photoshop web design and HTML. Part 1: line height'>Differences between Photoshop web design and HTML. Part 1: line height</a></li>
<li><a href='http://www.thebrightlines.com/2011/11/21/debugging-less-css/' rel='bookmark' title='Permanent Link: Tips for using and debugging of Less CSS code'>Tips for using and debugging of Less CSS code</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

