<?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; Debugging</title>
	<atom:link href="http://www.thebrightlines.com/tag/debugging/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>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>CSS debugging</title>
		<link>http://www.thebrightlines.com/2009/10/22/css-debugging/</link>
		<comments>http://www.thebrightlines.com/2009/10/22/css-debugging/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 20:21:16 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=8</guid>
		<description><![CDATA[Some text in your website has the wrong color or a box has more padding than it ought to have. Styles may pop up in the wrong places. No big deal, that happens all the time. But some times it can get hairy. Especially with unstructured CSS. So where to start debugging?]]></description>
			<content:encoded><![CDATA[<h2>Trace the styles</h2>
<p>What a relief when the CSS debuggers emerged. Before <a href="http://getfirebug.com/">Firebug</a> or IE&#8217;s <a href="http://en.wikipedia.org/wiki/Internet_Explorer_Developer_Toolbar">developer toolbar</a> we had to just <em>guess</em> what the problem was. Now we can see exactly which selector is overruling the other. If you&#8217;re still developing without one of those tools you should install one right away. And if you have Firefox you really need to take a look at what Firefox plugins are available for developers.</p>
<p><img title="Firebug in action" src="/article-data/images/Firebug-in-action.png" alt="" /></p>
<p>Firebug in action.</p>
<p>So what do you do if one CSS selector overrules yours? Well, the easiest solution is to just make your style more important. The easiest way to do that is to do something like this:</p>
<pre class="css">.myClass {
    width: 100% !important;
}</pre>
<p>That&#8217;s really simple, right?  But as always there is a negative side to it. The <em>!important</em> keyword is overruling anything else. That sounds handy but it also makes your CSS harder to control. If you start to use !important at the root of your HTML-tree (like &lt;body&gt;), you&#8217;ll most likely have to use !important all the way down to the leaves.</p>
<p>I prefer to structure my CSS in such a way that my CSS-file starts with global selectors like p and h1. After that I get more and more specific. In pratice this means that  I style the HTML structure from the root to the leaves.</p>
<p>A more practical way to make sure your styles are used above anything else is the use of id&#8217;s. Although I try to reserve id&#8217;s for Javascript many developers give common boxes like headers and footers an id to use in their CSS like this:</p>
<pre class="css">.logo {
    width: 50px;
}

#header .logo {
    width: 100px;
    padding: 0;
}</pre>
<p>I think that id&#8217;s are not needed in your CSS, but it&#8217;s easy and safe to use.</p>
<h2>Be explicit</h2>
<p>Besides structuring the CSS I like to be specific about where I want to use my styles. If I think I&#8217;m only going to use some in the footer I won&#8217;t write</p>
<pre class="css">.leftText {
    color: #ccc;
}</pre>
<p>but</p>
<pre class="css">.footer .leftText {
    color: #ccc;
}</pre>
<p>By specifying the path in the HTML I make sure that that style is only used in the footer. And if I want I can also use that class name to style something in the header as long as I specify the path. So that way I don&#8217;t have to worry much about keeping the class names unique as long as the paths are. This enables me to use generic class names like &#8220;.text&#8221;, &#8220;.alert&#8221; or &#8220;.column&#8221; multiple times.</p>
<p>I use this technique of specifying paths rather to prevent debugging than as a debugging tool. But if you have two conflicting styles, specifying the paths could be the solution to your problem.</p>
<h2>Validate your CSS</h2>
<p>If your style just doesn&#8217;t pop up and there is no other overruling style you propably have another problem on your hand. If you care about validation you could validate your CSS. When running a validation check, you might find a type or a missing curly bracket, but I must say: I don&#8217;t get such errors on a weekly basis.</p>
<p>On top of that, creating valid CSS and HTML doesn&#8217;t make much sense if your team members are not validation-aware. You may end up spending too much of your time fixing invalid code.</p>
<h2>Validate your HTML</h2>
<p>Sometimes your website looks broken because your HTML is broken. It&#8217;s easy to leave a tag unclosed without noticing it. Another way to break the HTML is to add a class attribute to a tag that already has a class attribute. In that case the browser doesn&#8217;t pick up the second attribute. Adding a second attribute is easily done when you&#8217;re working with somebody else&#8217;s code or if you have elements with lots of attributes.</p>
<h2>Disable your Javascript</h2>
<p>I very rarely have to blame Javascript, but sometimes Javascript is doing more than you know or want, like adding styles to the stylesheet or on an element itself. The latter case is easily recognized if you check an element with Firebug or the devtoolbar. Some libraries like some lightboxes jam elements full with attributes.</p>
<p>Javascript by the way is a major reason to use a debugging tool. That&#8217;s because you cannot see what Javascript does by requesting the source code from the browser. The source code that a browser supplies to you is the raw html that is delivered by the web server, <em>not</em> the HTML that is altered by Javascript.</p>


<p>Related posts:<ol><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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/10/22/css-debugging/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

