<?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>CSSquirrel &#187; trick</title>
	<atom:link href="http://cssquirrel.com/tag/trick/feed/" rel="self" type="application/rss+xml" />
	<link>http://cssquirrel.com/blog</link>
	<description>opinions and news on web design</description>
	<lastBuildDate>Wed, 23 May 2012 18:34:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using Inline-Block and Word-Spacing to Make Columns Easier</title>
		<link>http://cssquirrel.com/blog/2009/03/23/using-inline-block-and-word-spacing-to-make-columns-easier/</link>
		<comments>http://cssquirrel.com/blog/2009/03/23/using-inline-block-and-word-spacing-to-make-columns-easier/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 20:50:56 +0000</pubDate>
		<dc:creator>Kyle Weems</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[inline-block]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[word-spacing]]></category>

		<guid isPermaLink="false">http://www.cssquirrel.com/?p=194</guid>
		<description><![CDATA[Columns or grids, whatever you&#8217;re calling your blocks of content that are stacked next to each other, you&#8217;ve often got an annoyance when working on a design. I&#8217;ve probably covered this topic something like six million times, as I for one am easily annoyed by unnecessary floats, but historically found myself using them way too [...]]]></description>
			<content:encoded><![CDATA[<p>Columns or grids, whatever you&#8217;re calling your blocks of content that are stacked next to each other, you&#8217;ve often got an annoyance when working on a design. I&#8217;ve probably covered this topic something like six million times, as I for one am easily annoyed by unnecessary floats, but historically found myself using them way too much to make some sort of grid of blocks work out to make a designer&#8217;s dream a reality.</p>
<p>I don&#8217;t know why floats drive me bonkers. But they do. I feel like frequently they&#8217;re being used almost exclusively to solve problems that were never intended for them, and the end results can get messy as soon as a client starts using a carefully balanced page built upon delicate floats and adds an unexpected list or makes a given element too full or too empty.</p>
<p>Not terribly far back in the past I talked about <strong>display: inline-block</strong>, one of my favorite CSS style, as a solution to this problem at Mindfly in <a title="Link to the Curious Case of Inline Block" href="http://www.mindfly.com/blog/post/2008/12/The-Curious-Case-of-Inline-Block.aspx" target="_blank">The Curious Case of Inline-Block</a>. It provides a nice tutorial to getting columns of content to work side-by-side without floats using inline-block, and how thanks to the quick adoption rate of Firefox 3, all major browsers (including IE6) support this style (granted, IE6 &amp; 7 actually require a helping hand, but the tutorial discusses the easy fix).</p>
<p>I had one problem that nagged at me, though. Whitespace. In particular, the inline-block style is whitespace sensitive, so normal markup practice will result in your columns getting space between them when you use this style, which can mess with your carefully measured columns, and so forth. One possible fix is to simply remove any whitespace between the elements in question, but this is impractical for two reasons: 1. A lot of dynamically generated content won&#8217;t be set up with that sort of issue in mind, and 2. Clients entering their own content.</p>
<p>So I did some digging around, and through a complete accident later stumbled upon <strong>word-spacing</strong>, a style I&#8217;ve never had cause to make use of in the past. It&#8217;s simple enough as a style goes. Give it a value (in px, em, etc) and that&#8217;s how it modifies the existing whitespace between words. This counts for space between inline-block elements as well. So if you give the parent of those elements <strong>word-spacing: -1em</strong>, then it will remove the whitespace (normally 1em) that is between your inline-block elements. The catch? Make sure to give the elements themselves <strong>word-spacing: normal</strong> to resest the spacing for any text inside them, or you&#8217;ll get some nasty results.</p>
<p><a title="Link to Example Page" href="http://www.cssquirrel.com/testcases/ib_ws.htm" target="_blank">Here is an example</a> of positioning items side-by-side cleanly by using word-spacing and inline-block together (as well as showing the IE6&amp;7 fix). Of course, with the whitespace issue solved, you can add your own margins to elements to create whatever nice gutters and such that you prefer.</p>
]]></content:encoded>
			<wfw:commentRss>http://cssquirrel.com/blog/2009/03/23/using-inline-block-and-word-spacing-to-make-columns-easier/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

