In this tutorial we will learn methods to make a list display as multiple columns of list items, rather than as a single column or horizontal row. This can be a big space saver in some page designs, while still retaining the vertical ordering of a list. Since tabled layouts always linearize as a series of rows, this new method gives us the ability to provide screen readers with a source order that runs down each column instead of across each row. Not everyone will need this technique, but those who must deal with accessibility will find it highly useful.
The HTML:
<ul>
<li><a href=”#”>Antelope</a></li>
<li><a href=”#”>Baboon</a></li>
<li><a href=”#”>Bison</a></li>
<li><a href=”#”>Camel</a></li>
<li><a href=”#”>Chimpanzee</a></li>
<li><a href=”#”>Deer</a></li>
<li><a href=”#”>Eland</a></li>
<li><a href=”#”>Elk</a></li>
<li><a href=”#”>Gazelle</a></li>
<li><a href=”#”>Gibbon</a></li>
<li><a href=”#”>Kangaroo</a></li>
<li><a href=”#”>Meerkat</a></li>
<li><a href=”#”>Sheep</a></li>
<li><a href=”#”>Warthog</a></li>
<li><a href=”#”>Zebra</a></li>
</ul>
The CSS:
ul {
float: left;
width: 12em;
margin: 0;
padding: 0;
list-style: none;
}
li {
float: left;
width: 6em;
margin: 0;
padding: 0;
}
li a{
display: block;
width: 7.8em;
color: #036;
position: relative; /* for IE-Win */
}