A three column list

Pre 2006

My Shopping List (unordered)
  • Crisps
  • Chocolate
  • Cola
  • Fish
  • Steak
  • Milk
  • Sugar
  • Baked beans
  • Tinned Peas
  • Eggs
  • Coffee
  • Bread
  • Butter
  • Beer
My Shopping List (ordered - only Opera and FF v1.5 get the numbers right)
  1. Crisps
  2. Chocolate
  3. Cola
  4. Fish
  5. Steak
  1. Milk
  2. Sugar
  3. Baked beans
  4. Tinned Peas
  1. Eggs
  2. Coffee
  3. Bread
  4. Butter
  5. Beer

copyright © stu nicholls - CSS play

Information

Just unordered and ordered lists arranged in three columns using nothing more than css.

This method makes use of a definition list containing unordered lists for the top example, and ordered lists for the bottom example.

The idea of placing unordered and ordered lists within a definition list is discussed and promoted by w3c.org so it must be 'valid'.

This method also allows you to easily add a title to your list.

Because we can no longer specify a 'start' number for our ordered list I have used an alternative css method, BUT only Opera and FF v1.5 Beta 1 understand.

There really should be a css alternative to 'start='.

Cascading Style Sheet

#info dl {
  clear:both;
  width:728px;
  height:8em;
  margin:2em auto;}
#info dt {
  margin-bottom:1em; 
  font-weight:bold;}
#info dd {
  width:33%; 
  float:left; 
  margin:0;}
#info ol.first {
  counter-reset:item 0;}
#info ol.second {
  counter-reset:item 5;}
#info ol.third {
  counter-reset:item 9;}
#info ol li {
  display: block;}
#info ol li:before {
  content: counter(item) ". "; 
  counter-increment: item 1;}

xhtml

<dl>
<dt>My Shopping List (unordered)</dt>
<dd>
<ul class="first">
<li>Crisps</li>
<li>Chocolate</li>
<li>Cola</li>
<li>Fish</li>
<li>Steak</li>
</ul>
</dd>
<dd>
<ul class="second">
<li>Milk</li>
<li>Sugar</li>
<li>Baked beans</li>
<li>Tinned Peas</li>
</ul>
</dd>
<dd>
<ul class="third">
<li>Eggs</li>
<li>Coffee</li>
<li>Bread</li>
<li>Butter</li>
<li>Beer</li>
</ul>
</dd>
</dl>
<dl>
<dt>My Shopping List (ordered - only Opera and 
FF v1.5 get the numbers right)</dt>
<dd>
<ol class="first">
<li>Crisps</li>
<li>Chocolate</li>
<li>Cola</li>
<li>Fish</li>
<li>Steak</li>
</ol>
</dd>
<dd>
<ol class="second">
<li>Milk</li>
<li>Sugar</li>
<li>Baked beans</li>
<li>Tinned Peas</li>
</ol>
</dd>
<dd>
<ol class="third">
<li>Eggs</li>
<li>Coffee</li>
<li>Bread</li>
<li>Butter</li>
<li>Beer</li>
</ol>
</dd>
</dl>

Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.


Please ask permission before using or copying this example to your web site.


Please Support CSS play

Please note that if your donation is for a demo/menu then you will need to email me with the url of the demo/menu after making the donation

For more CSS demonstrations I recommend that you visit the Dynamic Drive CSS Library.


Free, practical CSS menus, layouts, and examples

Soft Geometry Creative Industries

Soft Geometry Creative Industries
is a music-based design company located in Bristol UK.
I create artwork for albums, singles, posters and t-shirts.
My work is influenced by punk and post-punk poster and flyer design,
lo-fi photocopy aesthetics,
Francis Bacon and Mark Rothko.

I can provide a start to finish service with my own art and photography, put together work from images provided by yourself, and collaborate on an idea.
softgeometrycreative{at}gmail.com

Follow CSS play


Facebook   Twitter   Facebook Fan Page