Pure CSS Table Free Layouts and Grids Template

A simple pure CSS table free layouts for two or three column website. This was made before Bootstrap and grid systems were invented.

By Tim TrottHTML & CSS Tutorials • April 20, 2008
Pure CSS Table Free Layouts and Grids Template

In a pure CSS-based layout, it is often necessary to create a section that resembles a table, i.e. an image on the left and text on the right. Without using tables, this can be a little tricky; however, with these templates, it is as simple as copying & paste.

This post was originally written pre-Bootstrap (i.e. a very long time ago). Bootstrap grids use the same techniques but are much more flexible and use classes instead of hard-coded styles. Other frameworks also exist which do the same thing, such as the 960 grid system.

These templates can be used to display content in a table-based layout or use them based on a table-less CSS web design - three columns or two columns with sidebars!

The column widths do not add up to 100% because of a CSS bug in the way IE renders DIV cells. You can use percentages or fixed width (px/em) for the widths; make sure they add up to slightly less than the page width; otherwise, the right-hand column will drop below in IE.

This method for CSS table-free layouts was devised way before Bootstrap columns, but I'm leaving it here if it is useful to someone who doesn't want to use large frameworks.

xml
<h2>Two Columns</h2>  
<div style="float: left; width: 50%;">
    <div style="padding: 5px; border:1px solid #aaa">
      Left Column Content
    </div>
  </div>
  <div style="float: left; width: 49%">
    <div style="padding: 5px; border:1px solid #aaa">
      Right Column Content
    </div>
  </div>
  <div style="clear:both"><span></span></div>
 
<h2>Three Columns</h2>
  <div>
    <div style="float:left; width:32%; border:1px solid #aaa">
      Left Column Content
    </div>
 
    <div style="float:left; width:32%; margin:0 1%; border:1px solid #aaa">
      Center Column Content
    </div>
 
    <div style="float:left; width:33%; border:1px solid #aaa">
      Right Column Content
    </div>
  </div> 
  <div style="clear:both"><span></span></div>

For ease of integration, I have used inline styles here; you may wish to convert the inline style to a class or ID. You can also change the percentages around to create uneven-width columns.

About the Author

Tim Trott is a senior software engineer with over 20 years of experience in designing, building, and maintaining software systems across a range of industries. Passionate about clean code, scalable architecture, and continuous learning, he specialises in creating robust solutions that solve real-world problems. He is currently based in Edinburgh, where he develops innovative software and collaborates with teams around the globe.

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

My website and its content are free to use without the clutter of adverts, popups, marketing messages or anything else like that. If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

This post has 2 comments. Why not join the discussion!

New comments for this post are currently closed.