<?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>x + 3 &#187; CSS</title>
	<atom:link href="http://xplus3.net/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://xplus3.net</link>
	<description></description>
	<lastBuildDate>Fri, 19 Aug 2011 01:05:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Redesign: x + 3 v2</title>
		<link>http://xplus3.net/2010/08/09/redesign-2/</link>
		<comments>http://xplus3.net/2010/08/09/redesign-2/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 11:37:14 +0000</pubDate>
		<dc:creator>Jonathan Brinley</dc:creator>
				<category><![CDATA[Etcetera]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://xplus3.net/?p=320</guid>
		<description><![CDATA[I&#8217;ve been remiss in calling attention to the redesign launched here a few months ago. May thanks to Stephanie for helping with the design. There&#8217;s still a fair amount of tweaking to be done (isn&#8217;t there always?), and I can&#8217;t promise universal browser support. I&#8217;m experimenting with a few newer CSS features. Notably: Headers use the Republikaps font, loaded using &#8230; <a href="http://xplus3.net/2010/08/09/redesign-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been remiss in calling attention to the redesign launched here a few months ago. May thanks to <a href="http://www.adeliedesign.com">Stephanie</a> for helping with the design.</p>
<p>There&#8217;s still a fair amount of tweaking to be done (isn&#8217;t there always?), and I can&#8217;t promise universal browser support.</p>
<p>I&#8217;m experimenting with a few newer CSS features. Notably:</p>
<ul>
<li>Headers use the Republikaps font, loaded using <code>@font-face</code></li>
<li>A fair number of drop-shadows are scattered throughout</li>
<li>The border of the main content area is a combination of two rounded-corner boxes, the inner with a drop-shadow, the outer with an inset drop-shadow (note that due to a <a href="http://code.google.com/p/chromium/issues/detail?id=29427">bug in WebKit</a>, Safari and Chrome users may see a square outer border)</li>
</ul>
<p>Much of the above won&#8217;t be visible to the 6% of my readers still on Internet Explorer. Frankly, I&#8217;m alright with that. In the past month, Opera&#8217;s 1.69% among visits to this site outranks IE6 and IE7 combined.</p>
<p>Let me know what you think, or call my attention to any bugs you might notice.</p>
]]></content:encoded>
			<wfw:commentRss>http://xplus3.net/2010/08/09/redesign-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Images for Form Submit Buttons Using CSS</title>
		<link>http://xplus3.net/2009/12/10/images-for-form-submit-buttons-using-css/</link>
		<comments>http://xplus3.net/2009/12/10/images-for-form-submit-buttons-using-css/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 20:11:16 +0000</pubDate>
		<dc:creator>Jonathan Brinley</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[forms]]></category>

		<guid isPermaLink="false">http://xplus3.net/?p=248</guid>
		<description><![CDATA[Browsers&#8217; default submit buttons can be boring, ugly, or just not match your site. Whatever your reason, it would be nice to dress up the buttons using CSS when you don&#8217;t want to (or can&#8217;t) change the HTML to use &#60;input type="image" /&#62; I&#8217;ve been struggling to find a way to do it in a cross-browser way, and just recently &#8230; <a href="http://xplus3.net/2009/12/10/images-for-form-submit-buttons-using-css/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Browsers&#8217; default submit buttons can be boring, ugly, or just not match your site. Whatever your reason, it would be nice to dress up the buttons using CSS when you don&#8217;t want to (or can&#8217;t) change the HTML to use <code>&lt;input type="image" /&gt;</code></p>
<p>I&#8217;ve been struggling to find a way to do it in a cross-browser way, and just recently stumbled upon the answer.<br />
<span id="more-248"></span></p>
<h3>The Problem</h3>
<p>Assume the following HTML snippet:</p>
<pre>
&lt;form action="" method="post"&gt;
  &lt;div class="form-submit"&gt;
    &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/div&gt;
&lt;/form&gt;</pre>
<p>Here&#8217;s my first attempt at CSS for the submit button (assume, here, that I have a 101x39px image to use for the submit button):</p>
<pre>form .form-submit input {
  display: block;
  width: 101px;
  height: 39px;
  background-color: transparent;
  background-image: url(submit.png);
  background-repeat: no-repeat;
  background-position: 0 0;
  padding: 0;
  margin: 0;
  border: none;
  cursor: pointer;
  text-indent: -9000px;
}</pre>
<p>Not to bad. It&#8217;s a standard CSS image replacement technique with a few small additions to override some default button styles. But in IE7 and below, the button disappears. Why is that? It seems the <code>text-indent</code> is applied to the whole <code>input</code>, sending it far off the screen.</p>
<p>So what if we remove that <code>text-indent</code>? As you might have guessed, the text still appears on top of the image. Even if we set <code>text-indent: 0</code> in a conditional comment for IE7 and below, you still have a problem for those browsers.</p>
<p>So what about putting the image into the padding, instead? </p>
<pre>
  text-indent: 0;
  padding: 39px 0 0 0;
  height: 0;
</pre>
<p>Once again, the button disappears in IE7 and below.</p>
<h3>The Solution</h3>
<p>But, what if one day you make a mistake? What if you forget to set <code>height</code> to <code>0</code> when you add the <code>padding-top</code>? Amazingly, you don&#8217;t get a 78px tall element; it remains 39px tall in all browsers (where all includes IE8, IE7, IE6, Firefox 3.5, Chrome 3, Safari 4, and Opera 10)! Why is that? I have no idea, but it works.</p>
<p>One problem still remains, though. In Opera, the text is still visible on top of the image. So we return to our good friend <code>text-indent</code>. Set it to an arbitrarily large negative number, but keep it at 0 for IE7 and below using CSS in a conditional comment. The button should now be replaced with an image in all browsers.</p>
<pre>form .form-submit input {
  display: block;
  width: 101px;
  height: 39px;
  background-color: transparent;
  background-image: url(submit.png);
  background-repeat: no-repeat;
  background-position: 0 0;
  padding: 39px 0 0 0;
  border: none;
  cursor: pointer;
  text-indent: -9000px;
}</pre>
<p>And don&#8217;t forget, in your <code>IE lte 7</code> conditional stylesheet:</p>
<pre>
form .form-submit input {
  text-indent: 0;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://xplus3.net/2009/12/10/images-for-form-submit-buttons-using-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Browser Statistics</title>
		<link>http://xplus3.net/2009/11/07/browser-statistics/</link>
		<comments>http://xplus3.net/2009/11/07/browser-statistics/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 15:31:45 +0000</pubDate>
		<dc:creator>Jonathan Brinley</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[browser support]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://xplus3.net/?p=235</guid>
		<description><![CDATA[My general rule for browser compatibility when I develop a site is to follow a simple formula: if a browser has a 5% or larger share, make sure the site works on that browser, with or without JavaScript. If it&#8217;s under 5%, make sure it works so long as JavaScript is enabled (since JavaScript can be used to work around &#8230; <a href="http://xplus3.net/2009/11/07/browser-statistics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My general rule for browser compatibility when I develop a site is to follow a simple formula: if a browser has a 5% or larger share, make sure the site works on that browser, with or without JavaScript. If it&#8217;s under 5%, make sure it works so long as JavaScript is enabled (since JavaScript can be used to work around a lot of bugs). If it&#8217;s under 1%, just ignore it.</p>
<p>I&#8217;m in the preliminary stages of thinking about a re-design for this site, so I thought it would be interesting to look at the browser statistics for my readers before I get going. </p>
<p>Here&#8217;s the breakdown for the last month, by browser (including those 1% and above):</p>
<table>
<thead>
<tr>
<th>Browser</th>
<th>Visitors</th>
</tr>
</thead>
<tbody>
<tr>
<td>Firefox</td>
<td>66.9%</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>10.6%</td>
</tr>
<tr>
<td>Safari</td>
<td>8.6%</td>
</tr>
<tr>
<td>Chrome</td>
<td>8.1%</td>
</tr>
<tr>
<td>Opera</td>
<td>3.2%</td>
</tr>
<tr>
<td>Mozilla</td>
<td>2.2%</td>
</tr>
</tbody>
</table>
<p>The order changes a bit when you break it down by browser version (again, only those 1% and above):</p>
<table>
<thead>
<tr>
<th>Browser</th>
<th>Version</th>
<th>Visitors</th>
</tr>
</thead>
<tbody>
<tr>
<td>Firefox</td>
<td>3.5.x</td>
<td>49%</td>
</tr>
<tr>
<td>Firefox</td>
<td>3.0.x</td>
<td>17%</td>
</tr>
<tr>
<td>Safari</td>
<td>4.0.x</td>
<td>8%</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>8.0</td>
<td>6%</td>
</tr>
<tr>
<td>Chrome</td>
<td>3.0.x</td>
<td>6%</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>7.0</td>
<td>4%</td>
</tr>
<tr>
<td>Opera</td>
<td>9.80</td>
<td>3%</td>
</tr>
<tr>
<td>Mozilla</td>
<td>1.9.x</td>
<td>2%</td>
</tr>
<tr>
<td>Firefox</td>
<td>2.0.x</td>
<td>1%</td>
</tr>
</tbody>
</table>
<p>Notice a browser not on that list? That&#8217;s right, fewer than 1% of my visitors use IE 6. As far as I&#8217;m concerned, that browser version is no longer supported for this site. It can hang out in the corner with Camino, Konquerer, and Firefox 1.5.</p>
<p>I&#8217;m also surprised by both the high position of Safari on the list and the low position of IE 7. It seems that a lot more people with Macs read this site than I expected (24% of my visitors) and that the IE users are actually upgrading (and if you haven&#8217;t yet, <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">please do so now</a>; it would be nice to get IE 7 under that 1% mark, too).</p>
<p>I&#8217;m still not to the point where I can rely on visitor&#8217;s browsers supporting much of CSS3, in large part due to the still-high position of Firefox 3.0.x. I anticipate that number dropping significantly in the coming months, though, so I may revisit this before I get around to actually doing a re-design. Overall, I would say things are trending in an agreeable direction, though (thank you!).</p>
<p><strong>Note:</strong> I should make it clear that the above conclusions only apply to this site, and have little bearing on other websites I develop. Unfortunately, IE 6 still has a strong impact elsewhere on the Internet.</p>
]]></content:encoded>
			<wfw:commentRss>http://xplus3.net/2009/11/07/browser-statistics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE Bug Improperly Displays Floats</title>
		<link>http://xplus3.net/2009/01/15/ie-bug-improperly-displays-floats/</link>
		<comments>http://xplus3.net/2009/01/15/ie-bug-improperly-displays-floats/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 14:15:28 +0000</pubDate>
		<dc:creator>Jonathan Brinley</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://xplus3.net/2008/01/18/ie-bug-improperly-displays-floats/</guid>
		<description><![CDATA[Updated (2009-01-15): I finally stumbled across the answer (see below). [Originally posted 2008-01-18] I&#8217;ve recently come to understand a bug in how Internet Explorer handles floats. I doubt this is a new discovery, but I haven&#8217;t read about it and can&#8217;t easily find it through Google. To put it simply, floated boxes should overlap non-positioned block boxes but displace inline &#8230; <a href="http://xplus3.net/2009/01/15/ie-bug-improperly-displays-floats/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Updated (2009-01-15):</strong> I finally stumbled across the answer (see below).</p>
<p><strong>[Originally posted 2008-01-18]</strong> I&#8217;ve recently come to understand a bug in how Internet Explorer handles floats. I doubt this is a new discovery, but I haven&#8217;t read about it and can&#8217;t easily find it through Google. To put it simply, floated boxes should overlap non-positioned block boxes but displace inline boxes; Internet Explorer displaces both. Now that I&#8217;ve said it simply, I&#8217;ll try to say it more clearly and accurately and with pictures.</p>
<p>We&#8217;ll start with a pretty simple XHTML document:</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
	&lt;head&gt;
		&lt;title&gt;IE Float Bug&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;p id="red"&gt;red&lt;/p&gt;
		&lt;p id="blue"&gt;blue&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Now let&#8217;s add some color and play with our <code>p</code> boxes, adding the following to our header:</p>
<pre>&lt;style type="text/css"&gt;
	p {
		margin: 0 5px 0 0;
		padding: 0;
		color: #FFFFFF;
		border: 5px solid #000000;
		text-align: center;
	}
	#red {
		background-color: #FF0000;
		width: 100px;
		height: 100px;
		line-height: 100px;
	}
	#blue {
		background-color: #0000FF;
		width: 150px;
		height: 150px;
		line-height: 150px;
	}
&lt;/style&gt;</pre>
<p>That should give us a page that looks like:</p>
<p><img src="http://xplus3.net/wp-content/uploads/2008/01/red_blue_001.gif" alt="Flowing red and blue boxes" /></p>
<p>Now, let&#8217;s add <code>float: left;</code> to <code>#red</code> and see what happens in Firefox:</p>
<p><img src="http://xplus3.net/wp-content/uploads/2008/01/red_blue_002.gif" alt="Floating red with blue, Firefox" /></p>
<p>To explain what&#8217;s going on here, <code>#red</code> is removed from the normal flow of the document. <code>#blue</code>, then, being a block box, moves to where it would be if <code>#red</code> were not in the document at all. The text inside of <code>#blue</code>, though, has to be aware (if you&#8217;ll allow this personification) of the float, because its line box has to be shortened to avoid overlapping with <code>#red</code>&#8216;s margin box. This all conforms to the <a href="http://www.w3.org/TR/CSS21/visuren.html#floats">CSS 2.1 visual formatting model</a>.</p>
<p>But look at what happens in Internet Explorer 7:</p>
<p><img src="http://xplus3.net/wp-content/uploads/2008/01/red_blue_003.gif" alt="Floating red with blue, IE" /></p>
<p>Instead of just displacing the text, the entire block-level box <code>#blue</code> has shifted to make room for <code>#red</code>. This would be entirely appropriate if I had created a new <a href="http://www.w3.org/TR/CSS21/visuren.html#block-formatting">block formatting context</a> by, for example, adding <code>overflow: hidden</code> to <code>#blue</code>. But so long as <code>#blue</code>&#8216;s <code>overflow</code> is set to its default value of <code>visible</code>, as it is here, we have no new block formatting context, so <code>#red</code> should overlap <code>#blue</code>.</p>
<p>So how do I fix this? How do I make IE render this the same way as Firefox? <del>I would appreciate any help.</del></p>
<h3>Update: The Answer</h3>
<p>If you can avoid triggering hasLayout in IE, then <code>#blue</code> will behave as it should. In the example above, setting <code>height</code> and <code>width</code> on <code>#blue</code> both triggered it, but with a few changes, we can avoid that to get the results we want.</p>
<p>First, remove <code>height</code> and <code>width</code> from <code>#blue</code>. To be honest, <code>height</code> wasn&#8217;t necessary, since line-height already sets the height of the element (assuming you&#8217;ve only one line of text).</p>
<p>So how do we constrain the width? By setting <code>width</code> on <code>body</code> (or a <code>div</code> that wraps both <code>p</code>s, if you want to do this in the context of a real page). So give <code>body</code> a <code>width</code> of <code>165px</code>(to accommodate the desired width, margin, and border or <code>#blue</code>).</p>
<p>So our final CSS looks like:</p>
<pre>&lt;style type="text/css"&gt;
	body {
		width: 165px;
	}
	p {
		margin: 0 5px 0 0;
		padding: 0;
		color: #FFFFFF;
		border: 5px solid #000000;
		text-align: center;
	}
	#red {
		background-color: #FF0000;
		width: 100px;
		height: 100px;
		line-height: 100px;
	}
	#blue {
		background-color: #0000FF;
		line-height: 150px;
	}
&lt;/style&gt;</pre>
<p>That gives us the same result in IE and Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://xplus3.net/2009/01/15/ie-bug-improperly-displays-floats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

