Display Continuous List in Two Columns
Here’s a quick and easy way to present a continuous list in two or more columns without having to hard code it. A recent project required a list of authors across two columns; the author names and links were auto generated using a WP tag so listing them in 2 columns required some simple CSS magic.
A typical list is below.
- <ul>
- <li>Web Design Link 1</li>
- <li>Web Design Link 2</li>
- <li>Web Design Link 3</li>
- <li>Web Design Link 4</li>
- <li>Web Design Link 5</li>
- <li>Web Design Link 6</li>
- </ul>
When rendered without any styling, it will appear like this:
- Web Design Link 1
- Web Design Link 2
- Web Design Link 3
- Web Design Link 4
- Web Design Link 5
- Web Design Link 6
Now wrap the unordered list within a div, let’s call the div “twocol” for the sake of this example:
- <div class=”twocol”>
- <ul>
- <li>Web Design Link 1</li>
- <li>Web Design Link 2</li>
- <li>Web Design Link 3</li>
- <li>Web Design Link 4</li>
- <li>Web Design Link 5</li>
- <li>Web Design Link 6</li>
- </ul>
- </div>
Add this style for class “twocol” in your stylesheet.
.twocol ul { width:400px; } /* this could be any length in px or % */
.twocol ul li { width: 40%; float: left; list-style: circle; padding-left: 18px; margin: 0px;}
Now the new list will look like this:
- Web Design Link 1
- Web Design Link 2
- Web Design Link 3
- Web Design Link 4
- Web Design Link 5
- Web Design Link 6
There you have it, a very simple way to display your lists of any length in two columns. The same method can be used to accomplish any finite number of columns, but with each additional column, the width of each column proportionately decreases.
Options



Hi, this is awesome. Just FYI, it doesn’t work in feeds. But thanks for this cool trick.
May 5th, 2008 at 12:20 pm
@ Robin
Glad you liked it. The stylesheet info is not packaged within the post, I actually added the code to my theme’s stylesheet for the sake of demonstrating, so yes, it will not work in RSS feeds.
May 5th, 2008 at 7:40 pm