Creating Text Columns With CSS3
March 14th, 2010
The recommended line length for a paragraph is generally 45-75 characters. With ever-growing monitor sizes, it is a continuing challenge for web designers to create readable copy. In this tutorial, I’ll show you how to use the CSS3 column-count property to create text columns on the fly.
Browser Support
Currently these styles are supported by Safari, Firefox, Chrome, and Camino.
Here’s What The CSS Looks Like
The CSS is actually pretty simple for this technique. We simply have to use the column-count property to set our columns. For the value, enter the number of columns you would like, in this case 2. You can also control the width of the column gap using the column-gap property. All you need to do is declare a width value in pixels, in this case 40px.
div {
-moz-column-count: 2;
-moz-column-gap: 40px;
-webkit-column-count: 2;
-webkit-column-gap: 40px;
}
Adding The HTML
The HTML for this example is also simple. Just paste all your text within a <div></div>. Make sure there are no extra line breaks or spaces in your copy. Post it all in one big paragraph.
<div>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</div>
Here’s What It Looks Like
The final output should be the above paragraph, divided into two columns. Check out the to see the results.
Support Files
That’s it, that’s all. Check out the live demo and download the source files below.
Print This Post
Follow me