Top 10 CSS Table Designs

Advertisement

By R. Christie

Tables have got to be one of the most difficult objects to style in the Web, thanks to the cryptic markup, the amount of detail we have to take care of, and lack of browser compatibility. A lot of time could be wasted on a single table although it’s just a simple one. This is where this article comes in handy. It will show you ten most easily implemented CSS table designs so you can style your tables in a zap!

Top 10 CSS Table Designs

First things first

We start with a valid xhtml 1.0 strict markup. Here is an example of a valid table markup:

<!-- Table markup-->

<table id="...">

	<!-- Table header -->

		<thead>
			<tr>
				<th scope="col" id="...">...</th>
				...
			</tr>
		</thead>

	<!-- Table footer -->

		<tfoot>
	        <tr>
	              <td>...</td>
	        </tr>
		</tfoot>

	<!-- Table body -->

		<tbody>
			<tr>
				<td>...</td>
				...
			</tr>
			...
		</tbody>

</table>

You can read more about xhtml table markup in HTML Dog’s Table Section. I have tested the tables below in Mozilla Firefox 3, IE 6 and 7, Opera 9.x and Safari. Also note that I apply a light blue color scheme to all of these tables to give the article a consistent look. You can modify the color scheme to match your site — the source package is provided in the end of the article.

Before we start, let’s review the general rule of thumb for styling of tables:

  1. Tables love space. Set the width of tables carefully, according to the content. If you don’t know the perfect width, simply set the width of the table to 100%. Tables look nicer when they have “overwidth”, and when it comes to tables too much width is definitely better than too little width.
  2. Cells need some padding. Sure, each table cell relates to each other. But it doesn’t mean that we have to pull them too close, right? Define some space between the cells, crammed up table cells are so much harder to read.
  3. Treat tables the way you treat content. Tables are read similarly to the way we read text — except it’s harder and it takes more time to read a table. So be careful with the amount of contrast you are giving to your table. Use soft colors — it’s easier for the eyes. Don’t treat your table like it’s a graphical decoration. Make sure that the style you apply to it makes the content more readable, not the other way around.

Now that we are all set up let’s get going, shall we?

1. Horizontal Minimalist

Horizontal tables are tables that are read rather horizontally than vertically. Each entity is represented by a row. You can style these types of tables with minimalist style. Simply set enough padding to the cells (td and th) and put a 2 pixel border underneath the header.

Employee Salary Bonus Supervisor
Stephen C. Cox $300 $50 Bob
Josephin Tan $150 - Annie
Joyce Ming $200 $35 Andy
James A. Pentel $175 $25 Annie

Because horizontal tables are supposed to be scanned horizontally, clearing the border of the table increases the efficiency of the table. The lack of border, however, makes this table design hard to read if it has too many rows. To counter it we simply add 1 pixel border underneath all td elements:

Employee Salary Bonus Supervisor
Stephen C. Cox $300 $50 Bob
Josephin Tan $150 - Annie
Joyce Ming $200 $35 Andy
James A. Pentel $175 $25 Annie

The tr:hover rules are very useful to aid people reading a minimally designed tables. When the mouse cursor hovers over a cell, the rest of the cells in the same row highlights immediately, making it easier to track things if your tables have multiple columns.

Important!
Carefully finetune the typography and the padding between the cells
Pros
Very easy to style, good for simple tables
Cons
tr:hover rules don’t work in IE 6, table can be confusing if it has too many columns
Play with
Color scheme, typography, tr:hover effects

2. Vertical Minimalist

Although rarely used, vertically oriented tables are useful for categorizing or comparing descriptions of objects, with each entity represented by a column. We can style it in minimalistic style by adding whitespace separators between columns.

Comedy Adventure Action Children
Scary Movie Indiana Jones The Punisher Wall-E
Epic Movie Star Wars Bad Boys Madagascar
Spartan LOTR Die Hard Finding Nemo
Dr. Dolittle The Mummy 300 A Bug’s Life

Add large border-left and border-right with the same color as background. You can use transparent borders if you want, but IE 6 screws it all up. Since this table is supposed to be read from top to bottom (vertically), adding tr:hover does not help and instead makes it harder to read the data. There is perhaps a Javascript-based solution which enables you to highlight the whole column when a mouseover event occurs, but that’s beyond the scope of this article.

Important!
Carefully finetune the typography and the padding between the cells, do not add tr:hover effect
Pros
Easy to style, good for simple tables
Cons
Can not be used if background is not a solid block of color, suitable only for some tables
Play With
Color scheme and typography

3. Box

The most dependable of all styles, the box style works for all kinds of tables. Pick a good color scheme and then distribute background-color to all the cells. Don’t forget to accentuate the differences of each cell by defining border as a separator. An example of a box style table is the following table:

Employee Salary Bonus Supervisor
Stephen C. Cox $300 $50 Bob
Josephin Tan $150 - Annie
Joyce Ming $200 $35 Andy
James A. Pentel $175 $25 Annie
Comedy Adventure Action Children
Scary Movie Indiana Jones The Punisher Wall-E
Epic Movie Star Wars Bad Boys Madagascar
Spartan LOTR Die Hard Finding Nemo
Dr. Dolittle The Mummy 300 A Bug’s Life

This style is nowadays probably the most used style. The tricky part is actually trying to find the color scheme that matches with your site. If your site is heavy on graphics, it will be pretty hard to use this style.

Important!
Choose a color scheme that matches with your site
Pros
Easy to style, flexible for large or small tables
Cons
Choosing the perfect color scheme could be tricky
Play with
Colors and borders, use dashed or dotted to achieve cute effects, typography, icons

4. Horizontal Zebra

Zebra-tables are pretty attractive and usable. The alternating background color can serve as a visual cue for people when scanning the table. To style a table as zebra, simply put a class="odd" to every odd ordered tr tag and define a style for it (e.g. using if ($count % 2) then even class else odd class in PHP).

	...

		<tr class="odd">
		   <td>...</td>
		   ...
		</tr>

		<tr>
		   <td>...</td>
		   ...
		</tr>

	...
Employee Salary Bonus Supervisor
Stephen C. Cox $300 $50 Bob
Josephin Tan $150 - Annie
Joyce Ming $200 $35 Andy
James A. Pentel $175 $25 Annie
Important!
Do not put too much contrast on the zebra colors, you can blind your users
Pros
The zebra pattern can help people to scan the table
Cons
Adding class="odd" manually can be very tedious for large tables, many content management systems do not provide even/odd features on a table loop, hence picking the color scheme may be tricky
Play With
Contrasting color, borders, typography, icons

5. Vertical Zebra Style

Vertical zebra is easier to style than the horizontal one, as we can make use of colgroup and col elements to distribute column classes. However, the markup becomes a little bit heavier:


<table>

		<!-- Colgroup -->
	   <colgroup>
	      <col class="vzebra-odd">
	      <col class="vzebra-even">
	      <col class="vzebra-odd">
	      <col class="vzebra-even">
	   </colgroup>

		<!-- Table header -->
	   <thead>
	      <tr>
	         <th scope="col" id="vzebra-comedy">Employee</th>
	         ...
	      </tr>
	   </thead>

	   ...
</table>

The colgroup element actually applies a style or class to the table, columnwise. Instead of tediously applying class for the first td or th element, we can use a more convenient colgroup-tag. For more information about colgroup visit this page.

Comedy Adventure Action Children
Scary Movie Indiana Jones The Punisher Wall-E
Epic Movie Star Wars Bad Boys Madagascar
Spartan LOTR Die Hard Finding Nemo
Dr. Dolittle The Mummy 300 A Bug’s Life

Although perhaps more suitable for vertically-oriented table, this zebra-style can also be used for any other kind of tables.

Important!
Do not put too much contrast on the zebra colors, you can blind your viewer
Pros
Suitable for all types of tables
Cons
Choosing the color scheme could be tricky, need to add colgroup elements
Play With
Contrasting color, borders, colgroup and col, icons and typography

6. One Column Emphasis

In some tables, some particular column may have a higher weight than the other columns. If that’s the case, you can use colgroup and col to make that particular column stand out. In the example below, the first column serves as the starting point to read, so it is emphasized, just like we emphasize the first letter of the paragraph as drop caps:

Company Q1 Q2 Q3 Q4
Microsoft 20.3 30.5 23.5 40.3
Google 50.2 40.63 45.23 39.3
Apple 25.4 30.2 33.3 36.7
IBM 20.4 15.6 22.3 29.3

You can also use one-column-emphasis-technique to highlight something important, say the column containing totals of an accounting table, or in a comparison table — for computer specification perhaps, the winning entity (column).

Important!
Be careful, don’t overdo the emphasis or the column will jump out, distracting the effort to read the rest of the columns.
Pros
Very effective when used in certain kind of tables
Cons
The necessary tr:hover effect does not work in IE, suitable for certain types of tables only
Play with
Color scheme, typography, icons and tr:hover effects

7. Newspaper

To achieve the so-called newspaper effect, apply border to table element and play with the cells inside. A quick, minimalistic newspaper style can look like this:

Company Q1 Q2 Q3 Q4
Microsoft 20.3 30.5 23.5 40.3
Google 50.2 40.63 45.23 39.3
Apple 25.4 30.2 33.3 36.7
IBM 20.4 15.6 22.3 29.3

Simply play with color scheme, borders, padding, backgrounds, and tr:hover effects of the cells (td and th). Other alternatives are presented below:

Company Q1 Q2 Q3 Q4
The above data were fictional and made up, please do not sue me
Microsoft 20.3 30.5 23.5 40.3
Google 50.2 40.63 45.23 39.3
Apple 25.4 30.2 33.3 36.7
IBM 20.4 15.6 22.3 29.3
Favorite Great Nice Bad
Passion of the Christ Bourne Ultimatum Shoot ‘Em Up Ali
The Big Fish The Mummy Apocalypto Monster
Shawshank Redemption Cold Mountain Indiana Jones Dead or Alive
Greatest Story Ever Told I Am Legend Star Wars Saw 3
Important!
Be careful with border-collapse, do not lose the signature border around the table!
Pros
Gives a royal, authorative aura to a table
Cons
Unsuitable for large tables (it loses it’s charm on large tables)
Play With
Typography, color scheme, background, border, padding, and tr:hover effects

8. Rounded Corner

Rounded corners are slick and modern, and it’s easy to apply it to a table, although you need to fire up Photoshop for this. Create images for all four corners of your table. Theoretically, we can make use of the nesting tr and td-elements to place the left and right corners of the table without adding additional markup. Unfortunately, IE 6 goes berserk and the table appears ugly, so the most stable way to do this is to put ID or class to all four corner cells of the table. Please consider the example below:

Company Q1 Q2 Q3 Q4
The above data were fictional and made up, please do not sue me  
Microsoft 20.3 30.5 23.5 40.3
Google 50.2 40.63 45.23 39.3
Apple 25.4 30.2 33.3 36.7
IBM 20.4 15.6 22.3 29.3
Pros
Great if you want untraditional table, probably the only viable option you have if your website uses rounded corners heavily
Cons
Takes longer to style, requires images
Play With
Color scheme, corner variations, typography, tr:hover effects, icons

9. Table Background

If you are looking for a quick and unique way to style your table, simply pick an attractive image or photo related to the subject of your table and set it to be the background-image of the table. You can add 50% grey png-image as background-image of the cells to improve readability, and that means that you need a CSS-hack to make it work in IE 6:


* html table tbody td
{

		  /* IE CSS Filter Hack goes here*/

}

The table would look like this:

Employee Division Suggestions
IE 6 users won’t see the transparent background if the hack is not applied
Stephen C. Cox Marketing Make discount offers
Josephin Tan Advertising Give bonuses
Joyce Ming Marketing New designs
James A. Pentel Marketing Better Packaging
Important!
Make sure the image is relevant to the table’s contents
Pros
Very easy to style, delivers unique look, if used correctly the image can serve as a symbol that gives outstanding impression on the viewer
Cons
Needs hack to get the background work in IE 6, needs images
Play With
Background images, transparent PNGs, typography, colors, icons

10. Cell Background

You can apply background-image to the cells and achieve a consistent look. Say you have at least half an hour to spare and you want something that’s not too bland. Start your Photoshop and make 1 pixel width gradients, and set them as background-image of all cells. You’ll end up with a gradient style table:

Employee Division Suggestions Rating
Give background color to the table cells to achieve seamless transition
Stephen C. Cox Marketing Make discount offers 3/10
Josephin Tan Advertising Give bonuses 5/10
Joyce Ming Marketing New designs 8/10
James A. Pentel Marketing Better Packaging 8/10

Similarly, pick a pattern and set it as background-image and you’ll end up with a pattern-styled-table:

Employee Salary Bonus Supervisor
Stephen C. Cox $300 $50 Bob
Josephin Tan $150 - Annie
Joyce Ming $200 $35 Andy
James A. Pentel $175 $25 Annie
Nation Capital Language Unique
Japan Tokyo Japanese Karate
South Korea Seoul Korean Ginseng
China Beijing Mandarin Kung-Fu
Indonesia Jakarta Indonesian Batik
Important!
Make sure the text stands out against the background
Pros
Easy to style, not too bland
Cons
Uses images, patterns and gradients might distract reading
Play With
Color scheme, patterns, typography, borders, backgrounds, gradients, icons

Final Words

I know I barely scratched the surface with this article, so grab the source and play around. Feel free to post your favourite table designs, especially if it’s something I missed out. Over to you.

About the author

R.Christie is studying information systems at college. He viciously juggles activities from college, web design, programming, church, to sport activities. You can say hello to him via e-mail.

#leftcolumn dl{display:block;margin-left:20px;}#leftcolumn dt{font-size:120%;color:#999;margin:10px 0 0;padding:0;}#leftcolumn dt.imp strong{font-weight:normal;color:red;}#leftcolumn dd{margin:0;padding:0;}#hor-minimalist-a{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;background:#fff;width:480px;border-collapse:collapse;text-align:left;margin:20px;}#hor-minimalist-a th{font-size:14px;font-weight:normal;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}#hor-minimalist-a td{color:#669;padding:9px 8px 0;}#hor-minimalist-a tbody tr:hover td{color:#009;}#hor-minimalist-b{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;background:#fff;width:480px;border-collapse:collapse;text-align:left;margin:20px;}#hor-minimalist-b th{font-size:14px;font-weight:normal;color:#039;border-bottom:2px solid #6678b1;padding:10px 8px;}#hor-minimalist-b td{border-bottom:1px solid #ccc;color:#669;padding:6px 8px;}#hor-minimalist-b tbody tr:hover td{color:#009;}#ver-minimalist{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:30px 30px 30px 15px;}#ver-minimalist th{font-weight:normal;font-size:14px;border-bottom:2px solid #6678b1;border-right:30px solid #fff;border-left:30px solid #fff;color:#039;padding:8px 2px;}#ver-minimalist td{border-right:30px solid #fff;border-left:30px solid #fff;color:#669;padding:12px 2px 0;}#box-table-a{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:20px;}#box-table-a th{font-size:13px;font-weight:normal;background:#b9c9fe;border-top:4px solid #aabcfe;border-bottom:1px solid #fff;color:#039;padding:8px;}#box-table-a td{background:#e8edff;border-bottom:1px solid #fff;color:#669;border-top:1px solid transparent;padding:8px;}#box-table-a tr:hover td{background:#d0dafd;color:#339;}#box-table-b{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:center;border-collapse:collapse;border-top:7px solid #9baff1;border-bottom:7px solid #9baff1;margin:20px;}#box-table-b th{font-size:13px;font-weight:normal;background:#e8edff;border-right:1px solid #9baff1;border-left:1px solid #9baff1;color:#039;padding:8px;}#box-table-b td{background:#e8edff;border-right:1px solid #aabcfe;border-left:1px solid #aabcfe;color:#669;padding:8px;}#hor-zebra{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:20px;}#hor-zebra th{font-size:14px;font-weight:normal;color:#039;padding:10px 8px;}#hor-zebra td{color:#669;padding:8px;}#hor-zebra .odd{background:#e8edff;}#ver-zebra{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:0 20px 20px 20px;}#ver-zebra th{font-size:14px;font-weight:normal;border-right:1px solid #fff;border-left:1px solid #fff;color:#039;padding:12px 15px;}#ver-zebra td{border-right:1px solid #fff;border-left:1px solid #fff;color:#669;padding:8px 15px;}.vzebra-odd{background:#eff2ff;}.vzebra-even{background:#e8edff;}#ver-zebra #vzebra-adventure,#ver-zebra #vzebra-children{background:#d0dafd;border-bottom:1px solid #c8d4fd;}#ver-zebra #vzebra-comedy,#ver-zebra #vzebra-action{background:#dce4ff;border-bottom:1px solid #d6dfff;}#one-column-emphasis{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:20px;}#one-column-emphasis th{font-size:14px;font-weight:normal;color:#039;padding:12px 15px;}#one-column-emphasis td{color:#669;border-top:1px solid #e8edff;padding:10px 15px;}.oce-first{background:#d0dafd;border-right:10px solid transparent;border-left:10px solid transparent;}#one-column-emphasis tr:hover td{color:#339;background:#eff2ff;}#newspaper-a{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;border:1px solid #69c;margin:20px;}#newspaper-a th{font-weight:normal;font-size:14px;color:#039;border-bottom:1px dashed #69c;padding:12px 17px;}#newspaper-a td{color:#669;padding:7px 17px;}#newspaper-a tbody tr:hover td{color:#339;background:#d0dafd;}#newspaper-b{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;border:1px solid #69c;margin:20px;}#newspaper-b th{font-weight:normal;font-size:14px;color:#039;padding:15px 10px 10px;}#newspaper-b tbody{background:#e8edff;}#newspaper-b td{color:#669;border-top:1px dashed #fff;padding:10px;}#newspaper-b tbody tr:hover td{color:#339;background:#d0dafd;}#newspaper-c{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;border:1px solid #6cf;margin:20px;}#newspaper-c th{font-weight:normal;font-size:13px;color:#039;text-transform:uppercase;border-right:1px solid #0865c2;border-top:1px solid #0865c2;border-left:1px solid #0865c2;border-bottom:1px solid #fff;padding:20px;}#newspaper-c td{color:#669;border-right:1px dashed #6cf;padding:10px 20px;}#rounded-corner{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:20px;}#rounded-corner thead th.rounded-company{background:#b9c9fe url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/left.png”) left -1px no-repeat;}#rounded-corner thead th.rounded-q4{background:#b9c9fe url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/right.png”) right -1px no-repeat;}#rounded-corner th{font-weight:normal;font-size:13px;color:#039;background:#b9c9fe;padding:8px;}#rounded-corner td{background:#e8edff;border-top:1px solid #fff;color:#669;padding:8px;}#rounded-corner tfoot td.rounded-foot-left{background:#e8edff url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/botleft.png”) left bottom no-repeat;}#rounded-corner tfoot td.rounded-foot-right{background:#e8edff url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/botright.png”) right bottom no-repeat;}#rounded-corner tbody tr:hover td{background:#d0dafd;}#background-image{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/blurry.jpg”) 330px 59px no-repeat;margin:20px;}#background-image th{font-weight:normal;font-size:14px;color:#339;padding:12px;}#background-image td{color:#669;border-top:1px solid #fff;padding:9px 12px;}#background-image tfoot td{font-size:11px;}#background-image tbody td{background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/back.png”);}* html #background-image tbody td{filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’table-images/back.png’,sizingMethod=’crop’);background:none;}#background-image tbody tr:hover td{color:#339;background:none;}#gradient-style{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;margin:20px;}#gradient-style th{font-size:13px;font-weight:normal;background:#b9c9fe url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/gradhead.png”) repeat-x;border-top:2px solid #d3ddff;border-bottom:1px solid #fff;color:#039;padding:8px;}#gradient-style td{border-bottom:1px solid #fff;color:#669;border-top:1px solid #fff;background:#e8edff url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/gradback.png”) repeat-x;padding:8px;}#gradient-style tfoot tr td{background:#e8edff;font-size:12px;color:#99c;}#gradient-style tbody tr:hover td{background:#d0dafd url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/gradhover.png”) repeat-x;color:#339;}#pattern-style-a{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/pattern.png”);margin:20px;}#pattern-style-a thead tr{background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/pattern-head.png”);}#pattern-style-a th{font-size:13px;font-weight:normal;border-bottom:1px solid #fff;color:#039;padding:8px;}#pattern-style-a td{border-bottom:1px solid #fff;color:#669;border-top:1px solid transparent;padding:8px;}#pattern-style-a tbody tr:hover td{color:#339;background:#fff;}#pattern-style-b{font-family:”Lucida Sans Unicode”, “Lucida Grande”, Sans-Serif;font-size:12px;width:480px;text-align:left;border-collapse:collapse;background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/patternb.png”);margin:20px;}#pattern-style-b thead tr{background:url(“http://media.smashingmagazine.com/images/express-css-table-design/table-images/patternb-head.png”);}#pattern-style-b th{font-size:13px;font-weight:normal;border-bottom:1px solid #fff;color:#039;padding:8px;}#pattern-style-b td{border-bottom:1px solid #fff;color:#669;border-top:1px solid transparent;padding:8px;}#pattern-style-b tbody tr:hover td{color:#339;background:#cdcdee;}.dp-highlighter{font-family:”Consolas”, “Courier New”, Courier, mono, serif;font-size:12px;background-color:#E7E5DC;width:99%;overflow:auto;padding-top:1px;margin:18px 0!important;}.dp-highlighter ol,.dp-highlighter ol li,.dp-highlighter ol li span{border:none;margin:0;padding:0;}.dp-highlighter a,.dp-highlighter a:hover{background:none;border:none;margin:0;padding:0;}.dp-highlighter .bar{padding-left:45px;}.dp-highlighter.collapsed .bar,.dp-highlighter.nogutter .bar{padding-left:0;}.dp-highlighter ol{list-style:decimal;background-color:#fff;color:#5C5C5C;margin:0 0 1px 45px !important;padding:0;}.dp-highlighter.nogutter ol,.dp-highlighter.nogutter ol li{list-style:none!important;margin-left:0!important;}.dp-highlighter ol li,.dp-highlighter .columns div{list-style:decimal-leading-zero;list-style-position:outside!important;border-left:3px solid #6CE26C;background-color:#F8F8F8;color:#5C5C5C;line-height:14px;margin:0!important;padding:0 3px 0 10px !important;}.dp-highlighter.nogutter ol li,.dp-highlighter.nogutter .columns div{border:0;}.dp-highlighter .columns{background-color:#F8F8F8;color:gray;overflow:hidden;width:100%;}.dp-highlighter .columns div{padding-bottom:5px;}.dp-highlighter ol li.alt{background-color:#FFF;color:inherit;}.dp-highlighter ol li span{color:black;background-color:inherit;}.dp-highlighter.collapsed ol{margin:0;}.dp-highlighter.collapsed ol li{display:none;}.dp-highlighter.printing{border:none;}.dp-highlighter.printing .tools{display:none!important;}.dp-highlighter.printing li{display:list-item!important;}.dp-highlighter .tools{font:9px Verdana, Geneva, Arial, Helvetica, sans-serif;color:silver;background-color:#f8f8f8;border-left:3px solid #6CE26C;padding:3px 8px 10px 10px;}.dp-highlighter.nogutter .tools{border-left:0;}.dp-highlighter.collapsed .tools{border-bottom:0;}.dp-highlighter .tools a{font-size:9px;color:#a0a0a0;background-color:inherit;text-decoration:none;margin-right:10px;}.dp-highlighter .tools a:hover{color:red;background-color:inherit;text-decoration:underline;}.dp-about{background-color:#fff;color:#333;margin:0;padding:0;}.dp-about table{width:100%;height:100%;font-size:11px;font-family:Tahoma, Verdana, Arial, sans-serif!important;}.dp-about td{vertical-align:top;padding:10px;}.dp-about .copy{border-bottom:1px solid #ACA899;height:95%;}.dp-about .title{color:red;background-color:inherit;font-weight:bold;}.dp-about .para{margin:0 0 4px;}.dp-about .footer{background-color:#ECEADB;color:#333;border-top:1px solid #fff;text-align:right;}.dp-about .close{font-size:11px;font-family:Tahoma, Verdana, Arial, sans-serif!important;background-color:#ECEADB;color:#333;width:60px;height:22px;}.dp-highlighter .comment,.dp-highlighter .comments{color:#008200;background-color:inherit;}.dp-highlighter .string{color:blue;background-color:inherit;}.dp-highlighter .keyword{color:#069;font-weight:bold;background-color:inherit;}.dp-highlighter .preprocessor{color:gray;background-color:inherit;}

Editor’s note

This post is one of the finalists of our guest author contest. Over three weeks selected top-10-lists and discussion articles will be published. To rate the articles we’ll analyze their popularity, users activity, quality of backlinks, traffic and further data.

How good is the post “Top 10 Express CSS Table Designs”?
( polls)

dp.SyntaxHighlighter.ClipboardSwf = “http://media.smashingmagazine.com/images/highlighting/flash/clipboard.swf”;dp.SyntaxHighlighter.HighlightAll(“code”);

Some contributors with just a single posting.

  1. 251

    SohoInteractive

    July 19th, 2009 5:07 pm

    Great collection
    Thanks you
    F.

    +11
    • 252

      George Bonev

      February 24th, 2011 5:15 am

      “About the author

      R.Christie is studying information systems at college. He viciously juggles activities from college, web design, programming, church, to sport activities. ”

      All seems fine except the church thing. Why brainwashing yourself when you have talent ?

      -41
      • 253

        Heraldmonkey

        April 28th, 2011 12:23 am

        All seems fine except the chip on your shoulder thing

        +13
      • 254

        Ceekays

        July 27th, 2011 9:59 pm

        @George Bonev:

        Yes, the church is good. It brainwashes all the stupid and inhuman stuff that you consume all day everyday. All in all, Christ saves! Bravo R.Christie for not being ashamed of the Gospel!!!

        0
    • 255

      luas

      May 12th, 2011 1:20 am

      hi, plz help me im trying to create page that will upload and it must have processing bar

      -21
  2. 256

    David J. Heinrich

    July 31st, 2009 5:18 pm

    Regarding the issue with vertical tables being inappropriate, that would seem to be right. The reason is because of the way screen-readers interpret them; how they are supposed to be interpreted by browsers. A screen reader will read a table row by row. Hence, data in rows should have relation to each other. The data in table #2 has no relation to each other (Scary Movie, Indiana Jones, The Punisher, Wall-E). This is because the first column isn’t a series of “column headers”.

    I think that the post saying that the proper way to display that would be as headings and unordered lists would be correct. Part of the other issue here is that there’s no reason why he lists of movies under a certain category has to be of the same length.

    As for how to get the side-by-side layout, you could abandon that and leave it as sequential layout (one beneath the other). Or you could use CSS floats to try that (but then you’d have to use the hacks to make sure they line up). If you’re fine with letting older browsers see it sequentially, you could use the new CSS tables layout method. This is a simple way to get a tables-like layout with just CSS; but it will only work on IE8, FF3, and other newer browsers.

    A sloppy hack that would still be better than expressing it as pure tabular data would be to nest headings and unordered lists inside of table data in a simple table with one row.

    +4
  3. 257

    government subcontractor

    August 19th, 2009 8:27 am

    Most of my contracts is converting old code to ASP.Net. The government has a lot of data and most apps are for the display and transfer of data. Very large databases are now using MS SQL and table are a large part of the UI. CSS is cool but not a cure all. Thanks for showing the difference in styles. it is what i want to know. Great job!
    Thanks

    +1
  4. 258

    DJ Dude

    September 14th, 2009 12:17 am

    nice article. Are css tables useful? I guess it’s more to do with if it’s properly used such as in tabular data vs layout div tags.

    +2
  5. 259

    Jack

    October 10th, 2009 3:52 am

    Am I the only one not seeing any of the examples in the article? I tried it in firefox 3 and IE 8

    -17
    • 260

      Juan

      June 7th, 2011 12:19 pm

      Download Google Chrome ASAP.

      +5
    • 261

      jimmyh

      June 21st, 2011 1:09 pm

      I guess you are :D

      -2
  6. 262

    Matt

    October 10th, 2009 5:50 am

    The examples all look the same to me (firefox 3, ubuntu). I assume someone removed the appropriate lines from the CSS file…. :)

    +1
  7. 263

    Si

    October 11th, 2009 4:06 pm

    can you please fix the css on this article please? Thanks!

    +1
  8. 264

    Sam

    October 12th, 2009 9:10 pm

    Yeah table design not showing up. Please fix. Need some inspiration.

    +1
  9. 265

    Sven Lennartz

    October 12th, 2009 11:37 pm

    Sorry folks. Vitaly just fixed it.

    +4
  10. 266

    tonier

    October 13th, 2009 8:51 pm

    every tag with html have their own reason, and if you want to show data, you need to use table! Don’t use div with flow etc …

    -3
  11. 267

    Mike

    October 15th, 2009 4:33 pm

    tr:hover does not work for IE but you can make use of className property example:

    CSS

    .trover{
    backgroud : #99BCBF;
    }
    .trout{
    backgroud : none;
    }
    —————————————————————————————————
    HTML

    using onmouseover and onmouseout you call the className depending if mouse is ove or out

    inside tr tag you put

    initializing with class = trout
    onmouseover = className=trover
    onmouseout = className = trout
    ——————————————————————————————————-

    This way you get te effect of tr :hover if your table is being seen usig IE. Hoper this comment is useful.

    0
    • 268

      Ben Lacey

      May 25th, 2011 12:29 am

      Something’s fishy about that CSS …. (.trout)
      Thanks for the code snippet, will come in handy, sorry for the bad joke :P

      +3
  12. 269

    siiniqi

    October 20th, 2009 12:46 am

    very good article keep it up.

    +1
  13. 270

    Nathan

    October 22nd, 2009 2:51 pm

    When people refer to “Using Tables Is Bad!” what is meant by that is the actual use of tables to layout and structure the websites data areas. This used to be ever so popular in the early days of the web. Using a table inline with the rest of your content is very acceptable and sometimes is the best way to display a group / collection / sampling of data just like the examples used in this article.

    +2
  14. 271

    Robin

    October 23rd, 2009 11:56 am

    I see alot of comments like “tables suck” and “**** tables”. To me it sounds like you peolple who wrote these comments dont know why, you just think its a cool thing to write.

    I have to say that though tables are most often a bad idea (like when people use them for entire layouts and such), there are times when they are very useful, like in the examples above, to use floats in such simple structures is simply overkill.

    To the author of this post I say bravo… I will probably use these alot.

    Visit my website by clicking on this link

    +3
  15. 272

    Usman Arshad

    October 25th, 2009 10:04 am

    very great article thanks for share, it help me a lot specially its “valid xhtml 1.0 strict” markup. usually i play with div even tabular data. but after now i am going to work on table for tabular data, thanks again for the nice post :-)

    0
  16. 273

    klickjobs

    October 27th, 2009 2:13 am

    Hi there!
    I love this list ….excellent!! Thank you so much!

    I have a question: Is there any possibillity to “sort” one of these lists?

    Hope someone can help me put :)

    greetings from germany
    klickjobs

    0
  17. 274

    x_maras

    October 27th, 2009 5:32 pm

    These are amazing!!!!

    Thank you!

    0
  18. 275

    killer_mentat

    October 28th, 2009 3:43 pm

    if it is a table you require, then it should be a table that you get.

    nice tables.

    0
  19. 276

    Chris Perabo

    November 10th, 2009 4:50 am

    I did two tables that I think are worth sharing (cause I’m proud of ‘em):
    http://www.caplinq.com/specialty_tapes/polyimide_kapton_tapes.html
    - Notice the alpha-image bottom right, and interchanging rows

    http://www.caplinq.com/linqstat_vcf_s-series_linqstat_volume_conductive_film.html#
    - A price table – looking sharp and clean.

    0
  20. 277

    Quique

    November 13th, 2009 3:31 am

    good job!!!!!!!!!!!!!!!!!!!!

    thanks for all

    0
  21. 278

    bob

    November 23rd, 2009 1:00 pm

    Of all the designs, I think the zebra tables are most appealing, particularly when the contrast is just high enough for a wide variety of users to differentiate between rows. It improves the readability of the table.

    0
  22. 279

    shaun

    December 7th, 2009 3:01 pm

    I’m wondering how to create a multi tabbed html table. The reason being is because I want to have 4 tables displayed on a single page. But only show one table at a time with an option for the user to switch from one table to another using tabs. I found an example of a website using this table at http://www.hertsbaseball.com I’m not to sure how to achieve this but I think it will probably involve jquery

    thanks

    -1
    • 280

      Allen

      February 3rd, 2010 9:36 am

      Google Jquery tabs.

      0
  23. 281

    Matt

    December 10th, 2009 12:01 pm

    Is anyone else having trouble unzipping the source?

    -1
  24. 282

    dakk

    December 21st, 2009 9:04 am

    @Matt : I think you may have issue with the permissions of the files inside the zip, just do a chmod755 in the extracted directory ;)

    -1
  25. 283

    Waseem Abbas

    December 31st, 2009 12:26 am

    Great stuff very help full.

    Thanks

    0
  26. 284

    Ujang

    January 4th, 2010 4:36 pm

    Nice designs.
    Thanks & happy new year!

    0
  27. 285

    Jacob

    January 14th, 2010 3:43 am

    I recently used this in a project. Wow, it looks so professional. Thanks a mill.

    0
  28. 286

    Ek9ay

    January 23rd, 2010 4:50 am

    Nice!Nice!Nice!

    0
  29. 287

    deadwin

    February 1st, 2010 2:25 am

    Awesome…style dude…thanx a lot…

    0
  30. 288

    dilip

    February 15th, 2010 11:47 pm

    good post….i will use this for my website

    0
  31. 289

    ZAky

    February 25th, 2010 1:33 am

    Beautiful I’ll use it.
    I most agree that tables is not the most attractive way to display data.
    But, in every application there is a backoffice section which most of it rendered as tables and for the right reason I think.

    +1
  32. 290

    Polly

    February 25th, 2010 4:20 am

    Fantastic article, thank you. Although, I can’t understand why people are commenting on the use of tables in layout, etc – this article is to do with display of tablature data – it’s nothing to do with laying out a website and the arguement of tables vs. CSS, etc.

    I think people just need somewhere to vent. I must admit website design and development is damn stressful ;D but basically, loving the article, very useful, thank you. Good luck with your college work C: xx

    +2
  33. 291

    Rach

    February 25th, 2010 2:53 pm

    Hey there, how do I implement this into my current style sheet?

    Thanks

    -2
  34. 292

    Darto KLoning

    March 9th, 2010 8:29 am

    wow, great job.

    0
  35. 293

    Aravind M Potadar

    March 10th, 2010 2:40 am

    Very useful…..Thanks a lot for sharing the source file. I had been searching for this. Grate collections!!!!

    0
  36. 294

    Abdul Aziz

    March 18th, 2010 12:21 am

    Very helpful article indeed. Worth reading. Please Keep up the good job.

    0
  37. 295

    Abdul Aziz

    March 18th, 2010 12:22 am

    Very helpful article indeed. Worth reading. Please keep up the good job .

    -1
  38. 296

    sholeh

    March 22nd, 2010 6:44 am

    nice tutorial, thank’s

    -1
  39. 297

    Alif

    March 26th, 2010 7:38 am

    Great post!. Its indeed a Smashing article :).

    -1
  40. 298

    Yogendra Ghorecha

    March 31st, 2010 5:36 am

    Gr8 tutorial, However provide more CSS to male it more concur.
    - Yogi Ghorecha

    -2
  41. 299

    e11world

    March 31st, 2010 10:05 am

    This is one of the most useful articles out there. Thank you so much!

    -1
  42. 300

    Ajay B Mali

    April 6th, 2010 1:09 am

    Nice to see such articles………………..very helpful in table/grid designing !!!

    Thanks !!

    0
  43. 301

    Karthik

    April 11th, 2010 10:20 pm

    Good article .. Really helpful .

    Keep it up

    0
  44. 302

    progres8

    April 19th, 2010 4:25 am

    Can somebody tell me why hover dont work for me in ie8

    http://cope.users.sbb.rs/proba.html

    0
  45. 303

    Jean-Francois Monfette

    April 21st, 2010 10:49 am

    Exactly what I was looking for. I think I don’t have to search google anymore to find web design advices. I just have to search through Smashing Magazine and I’m done !

    0
  46. 304

    Yaniv Y

    April 25th, 2010 10:00 pm

    Thanks! This post is very helpful for me.

    0
  47. 305

    Garren

    April 27th, 2010 6:21 am

    You know, one of the most important reasons that Tables are amazing, is for Emails. If you have a company that does newlsetters, etc, you’ll come to realize quickly that so many different email clients have different requirements, however, they ALL can read Tables perfectly. CSS’d and XTHML 1.0 validated of course.

    -1
  48. 306

    malek

    May 11th, 2010 3:36 am

    please tell me, how to create a table width css

    -5
  49. 307

    Michael

    May 23rd, 2010 3:56 pm

    This are some very good examples, however not for what I’d like to do…
    I have table of a week-schedule, I’d like to be able to style every column individually and every day has to be a different color (odd and even). Unfortunately I have no idea on how to do that, as I am a bit new to css. Any help would be greatly appreciated!

    This is a simplified version of the table:

    Day;Block;Class;Teacher;Location
    Monday;1;;;
    ______;2;;;
    ______;3;;;
    ______;4;Embedded Systems 1;Luc Fryant;D205
    ______;5;;;
    Tuesday;1;;;
    ______;2;Digital Systems;Bart Eestermans;D205
    ______;3;Light & Sound;Marjan Maes;D209
    ______;4;CCNA 1;Caroline Vanderheyden;P108Z
    ______;5;Digital Systems Lab;Patrick Dielens;P306
    Wednesday;1;Multimedia;Jan Janssen;P108Z
    ______;2;Networkdesign;Tony Binnemans;D011
    ______;3;Light & Sound;Marjan Maes;D211
    ______;4;CCNA 1;Caroline Vanderheyden;P108Z
    ______;5;Webdesign 1;Bart Portier;P108Z
    Thursday;1;;;
    ______;2;Digitale Systems;Bart Eestermans;E119
    ______;3;CCNA 1;Caroline Vanderheyden;P108Z
    ______;4;Embedded Systems 1 Lab;? (Den ambetanterik);P306B
    ______;5;;;
    Friday;1;Webdesign 1;Bart Portier;P108Z
    ______;2;;;
    ______;3;;;
    ______;4;;;
    ______;5;;;

    +1
  50. 308

    mjap

    June 3rd, 2010 4:10 am

    Thanks, Very good article.

    0
  51. 309

    Deepak

    June 16th, 2010 8:56 am

    Amazing articles, It helped me a lot. Thanks!!

    0
  52. 310

    Gareth Poole

    June 18th, 2010 7:23 am

    Thanks a lot, having some pretty hefty creative block this afternoon. That’s what Friday afternoons are for though? :-)

    0
  53. 311

    Aeron

    June 26th, 2010 1:18 am

    Nice Example of tables… :D

    0
  54. 312

    Moises Urrutia

    July 9th, 2010 9:56 am

    tr:hover does not work since ie did not support :hover pseudo class on anything but the anchor tag. The way to get around this is by using javascript to add a class of “hover” to your tr when your mouse is over it. Then you just create a style for tr.hover.

    -1
  55. 313

    Enver

    July 15th, 2010 5:28 am

    Great article… thanks a lot..

    0
  56. 314

    Andre

    July 23rd, 2010 8:42 am

    Yay tables!

    0
  57. 315

    Kimi Wei

    July 26th, 2010 8:21 pm

    Dude, you should rename this article. It doesn’t design any tables with CSS, it just styles the “look” of them. Once you use a table CSS design is shot down.

    -5
  58. 316

    benjamin a. petersen

    July 28th, 2010 4:36 am

    I love this article — I use the examples here as quick springboard for a table design all the time.

    0
  59. 317

    Beth Budwig

    July 28th, 2010 2:11 pm

    I realize this comment is on a post from two years ago, but I was referred here from Dan Cederholm’s most recent book on markup, and I’m surprised no one has mentioned the “caption” element. It’s a tag I’ve often wished I could use with images, but its only home is inside a table at the very top: http://www.w3schools.com/TAGS/tag_caption.asp.

    Also, to Kimi above — content and CSS typically dictate the design together. If you have tabular data, what’s the concern about using a table rather than a mess of divs or lis? I recommend Cederholm’s chapter on tables.

    Anyways, nice post. :)

    +1
  60. 318

    sadasd

    August 31st, 2010 5:27 pm

    asdas nice

    0
  61. 319

    ronnie

    September 1st, 2010 4:46 pm

    Great tutorial. I need this to know more about table style. Thanks

    0
  62. 320

    bora

    September 2nd, 2010 8:54 pm

    i like that perfect and i think use my web site

    0
  63. 321

    christ

    September 3rd, 2010 1:57 am

    very good! I like !

    0
  64. 322

    ks

    September 13th, 2010 8:05 am

    TABLEs r ugly and the hardest to work with, DIVs r much better

    -5
  65. 323

    Vincent

    September 28th, 2010 1:00 am

    It’s very useful to me. Thanks

    0
  66. 324

    denise

    October 13th, 2010 8:46 am

    great article and very timely – thanks!

    0
  67. 325

    eirjaf

    October 24th, 2010 9:31 pm

    Perfect !!!

    0
  68. 326

    angel

    October 25th, 2010 3:14 am

    thank you. best sample

    0
  69. 327

    Osama

    November 3rd, 2010 9:01 am

    Just excellent!

    -2
  70. 328

    Adrian Garner

    November 14th, 2010 5:26 pm

    Is there a reason you would apply the styles to IDs rather than classes?
    I thought IDs were supposed to be unique. There could be multiple tables on one page using the same style, in which case you would have to use the same ID twice to make the tables look the same.

    I suggest you change change #hoz-zebra to .hoz-zebra and to accordingly.

    Thanks for the nice styles ;)

    +1
  71. 329

    Vlada

    November 23rd, 2010 1:55 pm

    Excellent article, I tried few tables, modify a little and use one of them for personal site :)

    0
  72. 330

    Arnold W.

    November 25th, 2010 1:16 pm

    Thanks! This is great!!!!

    0
  73. 331

    Abdul Wahab

    November 29th, 2010 2:43 am

    really nice and great….. Salute to your hardwork

    +1
  74. 332

    srikanth portal

    December 12th, 2010 9:52 pm

    Nice designs..Thanks…

    +1
  75. 333

    Sean Wong

    December 13th, 2010 12:10 am

    it’s really good!!~useful for me, thanks!~upupup

    +1
  76. 334

    ViRuS23

    December 15th, 2010 7:52 pm

    Nice CSS Designs !!!
    Simple and Elegant to use, thanks for the info.

    +1
  77. 335

    Eric Nguyen

    December 20th, 2010 8:05 pm

    Ever since I started doing programming and searching for knowledge on the Internet, I haven’t found so many articles as good as this one.

    Thanks so much, R. Christie!
    Eric

    +1
  78. 336

    Martin

    December 27th, 2010 12:12 pm

    Very usefull you helped styling my tables very quicky using this examples. Thanks a lot!

    +1
  79. 337

    ThingsworkS

    December 29th, 2010 3:24 am

    great tutorial…but More patterns and color combinations would be appreciated.

    -2
  80. 338

    oluwaseun

    December 29th, 2010 10:35 am

    Great job dude. Saved me loads of DT (development time).

    +1
  81. 339

    pols

    January 28th, 2011 8:11 am

    This is very awesome!!!! great tutorial.. keep posting a great tutorial.. Cheers!!! :)

    +1
  82. 340

    JakeDaSnake

    February 1st, 2011 6:46 am

    These tables rock my world.

    +1
  83. 341

    michelle

    February 8th, 2011 5:57 am

    excellent info ! must be more people like you that share info so valuable and helpfull.

    +1
  84. 342

    Azeem Michael

    February 14th, 2011 12:43 pm

    thanks for creating a downloadable source files — made things a lot easier

    +1
  85. 343

    Pradeep

    February 20th, 2011 8:31 pm

    Genius! Thanks!!

    +1
  86. 344

    Mushal

    February 24th, 2011 8:00 am

    Hi guy, Thanks for the nice styles but I tried them with my cgi and they not working :(
    any help???
    Thanks

    -2
    • 345

      ChimericDream

      February 26th, 2011 8:59 am

      @Mushal,

      While I’m not the original poster, I can tell you that saying “it doesn’t work” will do absolutely nothing to get help. If you’re having problems, state what you have tried and exactly what is going wrong.

      Here’s a great article on effectively reporting bugs: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

      That said, I have used these styles on several websites over the past couple years with no issues, and they obviously work here. So my guess is there is something going wrong in your implementation.

      Sorry if this is coming across strong. I work as a developer as well, and it can get frustrating when the only feedback you get is “it’s broken, fix it!” with no further information.

      Hope that helps.

      +1
  87. 346

    Caylee

    March 15th, 2011 6:34 pm

    Coool… You’re so helpfull..
    Thank you so much to you ^-^

    +1
  88. 347

    Mwamba simbao

    March 16th, 2011 11:36 pm

    awesome just what i needed….

    +1
  89. 348

    Mohit

    March 17th, 2011 12:41 am

    It is good. I was just wondering if it’s possible to create a custom Design for the table. (I’m using WP-Table Reloaded from WordPress).

    Mohit Chopra

    +1
  90. 349

    Sush

    March 19th, 2011 11:27 pm

    This is a great article. But i want to mention one important thing. Usually we display lot of stuffs in a table. That needs a scroll. Any best way to scroll the table content with the header column in tact. Becoz, I tried including a div with scroll inside tbody. Providing overflow attribute to tbody works in mozilla only. Does not work in IE. Any help would be appreciated.

    Thank you

    +1
  91. 350

    david dawson

    March 25th, 2011 7:43 am

    Super usefull thanks! I’m now implemented this on 2 of my websites… can’t say how happy I am with it!

    +1
  92. 351

    Dinesh Balendran

    March 27th, 2011 6:23 pm

    Awesome you are a champ!

    +1
  93. 352

    Bahadur Asher

    April 4th, 2011 1:05 am

    Great article, it has helped me lot understanding tables and the icing on the cake was the source files, the explanation has simple to understand which made this article brilliant.

    Thank You very much

    P.S. wish someone could do the same with drop-down menus???

    +1
  94. 353

    Jayalakshmi

    April 5th, 2011 2:04 am

    Thanks a Lot..It was very usefull to me… Thanks

    +2
  95. 354

    osearth

    April 26th, 2011 5:20 pm

    thanks for sharing

    +1
  96. 355

    Scott Foubister

    April 28th, 2011 2:30 pm

    Thanks a lot, this was a great example to learn about tables styles.

    +1
  97. 356

    Hasn

    May 2nd, 2011 6:04 pm

    Thanks a lot,
    very nice work and helped me in styling my pages
    Cheers

    +1
  98. 357

    MrJuan

    May 19th, 2011 11:29 am

    Is anybody else having issues in IE8? For some reason, the table headings (column titles) are shifted more to the right. You can see what I mean if you view this article in IE8.. I couldn’t isolate the problem in the CSS. Any ideas?

    +1
    • 358

      MrJuan

      May 19th, 2011 12:37 pm

      I fixed it by removing the width in the main class and adding a padding-right to the th.

      +1
  99. 359

    vee

    May 30th, 2011 1:23 am

    I barely no idea with css and page design. You save my life indeed. Thank you for your kind of sharing things : )

    +1
  100. 360

    kouysocheat

    May 31st, 2011 6:37 pm

    it’s special for me,thanks

    +1
  101. 361

    Nanang Gunawan

    June 9th, 2011 6:30 pm

    perfect table..

    thanks… very usefull….

    +1
  102. 362

    nhoj

    June 11th, 2011 7:16 pm

    supah cool…

    +1
  103. 363

    Pim Schaaf

    June 13th, 2011 2:13 am

    Very nice! Thanks a lot!

    I add:

    cursor:pointer;

    to the tr:hover td styles when I use the table rows as links.

    +1
  104. 364

    Mike Combs

    June 15th, 2011 8:48 am

    I think vertical tables are legitimate and useful when you want to compare a few items to each other. The key is that each row should compare a single type of item, but each cell can contain several items. In the example here, the second row has several titles of movies. It would be wrong to put each movie title in a row to itself; it’s okay to have a different number of movies in each cell.

    If you wanted to add a third row, like top directors for the genre, for clarity you’d probably have to add a label column on the left. That would change the table back to a more traditional grid.

    +1
  105. 365

    Jessica Nolhein

    June 21st, 2011 12:51 pm

    Hi there, nice to see you guy here – keep up the good work

    +1
  106. 366

    assad

    June 29th, 2011 8:36 pm

    Awesome post man… :)

    +1
  107. 367

    Ashwin Hegde

    July 7th, 2011 12:32 am

    Good Job Bro…

    +1
  108. 368

    EddieRenz

    July 12th, 2011 11:27 am

    OMW. This article and the downloadable set of files just saved me some serious hours of coding. I was going to do the table in CSS, but with 3 columns and 10 rows – the spacing and formatting was going to be a huge nightmare. This works flawlessly – except for the CSS Rule – Border-Collapse – which just needs to be modified to cellspacing=”0″ in the HTML instead of trying to make it work in the CSS. EXCELLENT article though, I had no ideas tables could be so awesome!

    +4
  109. 369

    rajesh

    July 18th, 2011 1:57 am

    nice tutorial:)
    how to design table with fixed header with browser compatibility with pure css ?

    +1
  110. 370

    rajesh

    July 18th, 2011 2:05 am

    can anyone plz help me
    how to create a table with fixed header with browser compatibility ?

    only in pure css with no javascript ? ):

    -2
  111. 371

    Chris Quinn

    August 5th, 2011 8:15 pm

    I love them, quick access to some great CSS Table styling. Thanks!

    +2
  112. 372

    michael

    August 7th, 2011 3:14 pm

    still so useful til this day! great tutorial, thanks so much.

    +1
  113. 373

    eli

    August 16th, 2011 6:38 pm

    You could use a style generator for the tables as well. Here is one of them http://gridstyler.com, can do more of the basic things easily but limited.

    +1
  114. 374

    Matt

    August 24th, 2011 2:18 am

    This article was great, I used to struggle with table css but this really really helped.

    +1
  115. 375

    Killer

    September 7th, 2011 12:54 am

    Very valuable info….great tutorial..Thanks a lot man.

    +1
  116. 376

    eg

    September 7th, 2011 6:12 am

    Here is a tool which I use for simple table styling, mainly for data grid stuff. http://tablestyler.com
    The techniques are a little more in depth. You might be able to use the two together.

    +1
  117. 377

    Suyash Sumaroo

    September 12th, 2011 10:13 pm

    Really nice work..will really help me to design tables quickly

    +1
  118. 378

    Chad

    September 19th, 2011 11:47 am

    I’m reading this article also it seems to be terrific! Nice way of writing and you’ve got explained some excellent points with this issue.

    +1
  119. 379

    Paul

    October 13th, 2011 4:01 am

    Thanks for the artcile, esspecially the source file! I learned lots from this!

    Thanks!

    +1
  120. 380

    Maico

    October 18th, 2011 3:35 am

    thanks a lot! keep with this good job

    +1
  121. 381

    Varsha

    October 20th, 2011 11:17 pm

    Very useful article .. thank you ..

    +1
  122. 382

    Fasya

    November 9th, 2011 9:49 pm

    it’s very beatutiful & useful…
    how awesome it is..

    +1
  123. 383

    erin

    November 13th, 2011 9:32 pm

    it is really helpful also looking beautiful. thank you for your inspirational tutorial

    +1
  124. 384

    Michael

    November 20th, 2011 3:50 am

    Thank you for this; it was very useful to see some great layouts and give to some worthwhile input upon how certain attributes affect the readability etc :)

    +1
  125. 385

    Yogesh

    December 5th, 2011 3:17 am

    Thank u so much…..:)

    -1
  126. 386

    John Doe

    December 8th, 2011 12:05 pm

    I used one of those designs in my web programming exam, thanks man, i fucking hate designing shit :D

    0
  127. 387

    Fábio Rodrigues

    December 12th, 2011 8:21 am

    You can add rounded corner to an table without using photoshop. In most modern browsers (that is no ie6) use this css tag:

    border-radius: npx;

    where n is number of pixels of rounding. I normaly use 5px.

    0
    • 388

      manan

      December 14th, 2011 4:44 am

      .Table {
      border: 1px solid #BBBBBB;
      border-collapse: collapse;
      padding: 5px;
      }
      apply this css for table
      .Table td {
      padding: 8px 12px;

      }
      .Table td td{
      padding: 0;
      }
      .Table td .Table td{
      padding: 0 5px;
      border-right: 1px solid #BBBBBB;

      height: 30px;

      }
      .Table .input {
      border: 1px solid #BBBBBB;
      background:#FFFFFF;
      width: 215px;
      height: 20px;
      }

      +1
  128. 389

    Clay

    December 19th, 2011 9:20 am

    Thanks for posting this. I’ve been looking for a lightweight table. I see you have a few examples that highlight rows, can you post one that highlights columns?

    +1
  129. 390

    Keith Davis

    January 22nd, 2012 5:41 am

    Not done any html / CSS for tables for ages – I’m a bit rusty.

    Thanks for the tutorial and thanks for providing the source files.

    Much appreciated.

    0
  130. 391

    Greg

    January 26th, 2012 3:40 am

    I can’t choose “bad” in the quality poll.

    0
  131. 392

    Lucas

    February 3rd, 2012 8:15 pm

    Hey! Could you guys fix the CSS on this article, please? I’m using Google Chrome (in Ubuntu) and all the examples look the same! :(

    +5

  1. 1

    Heraldmonkey

    April 28th, 2011 12:23 am

    All seems fine except the chip on your shoulder thing

    +13
  2. 2

    SohoInteractive

    July 19th, 2009 5:07 pm

    Great collection
    Thanks you
    F.

    +11
  3. 3

    Juan

    June 7th, 2011 12:19 pm

    Download Google Chrome ASAP.

    +5
  4. 4

    Lucas

    February 3rd, 2012 8:15 pm

    Hey! Could you guys fix the CSS on this article, please? I’m using Google Chrome (in Ubuntu) and all the examples look the same! :(

    +5
  5. 5

    David J. Heinrich

    July 31st, 2009 5:18 pm

    Regarding the issue with vertical tables being inappropriate, that would seem to be right. The reason is because of the way screen-readers interpret them; how they are supposed to be interpreted by browsers. A screen reader will read a table row by row. Hence, data in rows should have relation to each other. The data in table #2 has no relation to each other (Scary Movie, Indiana Jones, The Punisher, Wall-E). This is because the first column isn’t a series of “column headers”.

    I think that the post saying that the proper way to display that would be as headings and unordered lists would be correct. Part of the other issue here is that there’s no reason why he lists of movies under a certain category has to be of the same length.

    As for how to get the side-by-side layout, you could abandon that and leave it as sequential layout (one beneath the other). Or you could use CSS floats to try that (but then you’d have to use the hacks to make sure they line up). If you’re fine with letting older browsers see it sequentially, you could use the new CSS tables layout method. This is a simple way to get a tables-like layout with just CSS; but it will only work on IE8, FF3, and other newer browsers.

    A sloppy hack that would still be better than expressing it as pure tabular data would be to nest headings and unordered lists inside of table data in a simple table with one row.

    +4
  6. 6

    Sven Lennartz

    October 12th, 2009 11:37 pm

    Sorry folks. Vitaly just fixed it.

    +4
  7. 7

    EddieRenz

    July 12th, 2011 11:27 am

    OMW. This article and the downloadable set of files just saved me some serious hours of coding. I was going to do the table in CSS, but with 3 columns and 10 rows – the spacing and formatting was going to be a huge nightmare. This works flawlessly – except for the CSS Rule – Border-Collapse – which just needs to be modified to cellspacing=”0″ in the HTML instead of trying to make it work in the CSS. EXCELLENT article though, I had no ideas tables could be so awesome!

    +4
  8. 8

    Robin

    October 23rd, 2009 11:56 am

    I see alot of comments like “tables suck” and “**** tables”. To me it sounds like you peolple who wrote these comments dont know why, you just think its a cool thing to write.

    I have to say that though tables are most often a bad idea (like when people use them for entire layouts and such), there are times when they are very useful, like in the examples above, to use floats in such simple structures is simply overkill.

    To the author of this post I say bravo… I will probably use these alot.

    Visit my website by clicking on this link

    +3
  9. 9

    Ben Lacey

    May 25th, 2011 12:29 am

    Something’s fishy about that CSS …. (.trout)
    Thanks for the code snippet, will come in handy, sorry for the bad joke :P

    +3
  10. 10

    DJ Dude

    September 14th, 2009 12:17 am

    nice article. Are css tables useful? I guess it’s more to do with if it’s properly used such as in tabular data vs layout div tags.

    +2
  11. 11

    Nathan

    October 22nd, 2009 2:51 pm

    When people refer to “Using Tables Is Bad!” what is meant by that is the actual use of tables to layout and structure the websites data areas. This used to be ever so popular in the early days of the web. Using a table inline with the rest of your content is very acceptable and sometimes is the best way to display a group / collection / sampling of data just like the examples used in this article.

    +2
  12. 12

    Polly

    February 25th, 2010 4:20 am

    Fantastic article, thank you. Although, I can’t understand why people are commenting on the use of tables in layout, etc – this article is to do with display of tablature data – it’s nothing to do with laying out a website and the arguement of tables vs. CSS, etc.

    I think people just need somewhere to vent. I must admit website design and development is damn stressful ;D but basically, loving the article, very useful, thank you. Good luck with your college work C: xx

    +2
  13. 13

    Jayalakshmi

    April 5th, 2011 2:04 am

    Thanks a Lot..It was very usefull to me… Thanks

    +2
  14. 14

    Chris Quinn

    August 5th, 2011 8:15 pm

    I love them, quick access to some great CSS Table styling. Thanks!

    +2
  15. 15

    Varsha

    October 20th, 2011 11:17 pm

    Very useful article .. thank you ..

    +1
  16. 16

    Hasn

    May 2nd, 2011 6:04 pm

    Thanks a lot,
    very nice work and helped me in styling my pages
    Cheers

    +1
  17. 17

    Matt

    October 10th, 2009 5:50 am

    The examples all look the same to me (firefox 3, ubuntu). I assume someone removed the appropriate lines from the CSS file…. :)

    +1
  18. 18

    erin

    November 13th, 2011 9:32 pm

    it is really helpful also looking beautiful. thank you for your inspirational tutorial

    +1
  19. 19

    kouysocheat

    May 31st, 2011 6:37 pm

    it’s special for me,thanks

    +1
  20. 20

    Fred

    August 14th, 2008 2:32 pm

    Tables do not “suck”. They are really useful. They may “suck” for when you are doing a layout, but for tabular data they are perfect.

    +1
  21. 21

    Arnar

    August 15th, 2008 5:57 am

    It’s not that tables suck, it’s inproper use of tables that sucks.

    +1
  22. 22

    Michiel

    January 30th, 2009 6:10 pm

    I love the way there are more table-basher-bashers than table-bashers XD

    I think that it’s lcear that tables are a no-no for webdesign and a yes-yes for tabular information. How about we stop telling people this?

    +1
  23. 23

    mikeymouk

    February 18th, 2009 7:31 am

    thanks for sharing this. May everyone feel happy with whatever they use as long as it fulfills their purpose. There is no competition on knowledge on the internet, and even less reasons to manifest its tensions. long life to free sharing !~

    +1
  24. 24

    government subcontractor

    August 19th, 2009 8:27 am

    Most of my contracts is converting old code to ASP.Net. The government has a lot of data and most apps are for the display and transfer of data. Very large databases are now using MS SQL and table are a large part of the UI. CSS is cool but not a cure all. Thanks for showing the difference in styles. it is what i want to know. Great job!
    Thanks

    +1
  25. 25

    Si

    October 11th, 2009 4:06 pm

    can you please fix the css on this article please? Thanks!

    +1
  26. 26

    Sam

    October 12th, 2009 9:10 pm

    Yeah table design not showing up. Please fix. Need some inspiration.

    +1
  27. 27

    siiniqi

    October 20th, 2009 12:46 am

    very good article keep it up.

    +1
  28. 28

    ZAky

    February 25th, 2010 1:33 am

    Beautiful I’ll use it.
    I most agree that tables is not the most attractive way to display data.
    But, in every application there is a backoffice section which most of it rendered as tables and for the right reason I think.

    +1
  29. 29

    Michael

    May 23rd, 2010 3:56 pm

    This are some very good examples, however not for what I’d like to do…
    I have table of a week-schedule, I’d like to be able to style every column individually and every day has to be a different color (odd and even). Unfortunately I have no idea on how to do that, as I am a bit new to css. Any help would be greatly appreciated!

    This is a simplified version of the table:

    Day;Block;Class;Teacher;Location
    Monday;1;;;
    ______;2;;;
    ______;3;;;
    ______;4;Embedded Systems 1;Luc Fryant;D205
    ______;5;;;
    Tuesday;1;;;
    ______;2;Digital Systems;Bart Eestermans;D205
    ______;3;Light & Sound;Marjan Maes;D209
    ______;4;CCNA 1;Caroline Vanderheyden;P108Z
    ______;5;Digital Systems Lab;Patrick Dielens;P306
    Wednesday;1;Multimedia;Jan Janssen;P108Z
    ______;2;Networkdesign;Tony Binnemans;D011
    ______;3;Light & Sound;Marjan Maes;D211
    ______;4;CCNA 1;Caroline Vanderheyden;P108Z
    ______;5;Webdesign 1;Bart Portier;P108Z
    Thursday;1;;;
    ______;2;Digitale Systems;Bart Eestermans;E119
    ______;3;CCNA 1;Caroline Vanderheyden;P108Z
    ______;4;Embedded Systems 1 Lab;? (Den ambetanterik);P306B
    ______;5;;;
    Friday;1;Webdesign 1;Bart Portier;P108Z
    ______;2;;;
    ______;3;;;
    ______;4;;;
    ______;5;;;

    +1
  30. 30

    Beth Budwig

    July 28th, 2010 2:11 pm

    I realize this comment is on a post from two years ago, but I was referred here from Dan Cederholm’s most recent book on markup, and I’m surprised no one has mentioned the “caption” element. It’s a tag I’ve often wished I could use with images, but its only home is inside a table at the very top: http://www.w3schools.com/TAGS/tag_caption.asp.

    Also, to Kimi above — content and CSS typically dictate the design together. If you have tabular data, what’s the concern about using a table rather than a mess of divs or lis? I recommend Cederholm’s chapter on tables.

    Anyways, nice post. :)

    +1

Leave a Comment

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!

↑ Back to top