<?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>Thu, 29 Jul 2010 22:44:34 +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>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="/article-data/downloads/codeview.zip"><span> </span>Download Codeview</a></p>
<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 complete fresh CSS in a separate file. Nothing else is added to the template (yet), so it&#8217;s a fast loading website.</p>
<p>There are even no pictures added to the template, although it may not look that way because of the CSS3 styles that generate gradients, shadows and rounded corners. These effects are not visible in IE, except for rounded corners in IE9. So in case of IE, you&#8217;ll just see a simpler version of the website.</p>
<p>Here are some screenshots:</p>
<div class="wp-caption alignnone" style="width: 450px"><img title="Class view" src="/article-data/images/codeview-1.jpg" alt="Class view" width="440" height="413" /><p class="wp-caption-text">Class view</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="Class overview" src="/article-data/images/codeview-2.jpg" alt="Class overview" width="440" height="413" /><p class="wp-caption-text">Class overview</p></div>
<div class="wp-caption alignnone" style="width: 450px"><img title="File overview" src="/article-data/images/codeview-3.jpg" alt="File overview" width="440" height="413" /><p class="wp-caption-text">File overview</p></div>


<p>Related posts:<ol><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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2010/05/06/new-template-for-jsdoctoolkit-codeview/feed/</wfw:commentRss>
		<slash:comments>2</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>
</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>0</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/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/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/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>No related posts.</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>No related posts.</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>
</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>2</slash:comments>
		</item>
	</channel>
</rss>
