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.

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)

Some contributors with just a single posting.

  1. 251

    SohoInteractive

    July 19th, 2009 5:07 pm

    Great collection
    Thanks you
    F.

    +13
    • 252

      “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 ?

      -78
      • 253

        All seems fine except the chip on your shoulder thing

        +34
      • 254

        @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!!!

        -11
    • 255

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

      -43
  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.

    +5
  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

    -7
  4. 258

    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

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

    -24
  6. 263

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

    +1
  7. 264

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

    0
  8. 265

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

    +1
  9. 266

    Sorry folks. Vitaly just fixed it.

    +4
    • 267

      Thanks for fixing it I keep coming back to this article everytime I need to style any tables in my projects <3

      +1
  10. 268

    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 …

    -7
  11. 269

    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.

    +2
    • 270

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

      +4
  12. 271

    very good article keep it up.

    +1
  13. 272

    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.

    +6
  14. 273

    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

    +4
  15. 274

    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 :-)

    +1
  16. 275

    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

    +1
  17. 276

    These are amazing!!!!

    Thank you!

    +1
  18. 277

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

    nice tables.

    +1
  19. 278

    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.

    +1
  20. 279

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

    thanks for all

    +1
  21. 280

    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.

    +1
  22. 281

    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

    0
  23. 283

    Is anyone else having trouble unzipping the source?

    0
  24. 284

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

    0
  25. 285

    Great stuff very help full.

    Thanks

    0
  26. 286

    Nice designs.
    Thanks & happy new year!

    -1
  27. 287

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

    0
  28. 288

    Nice!Nice!Nice!

    0
  29. 289

    Awesome…style dude…thanx a lot…

    0
  30. 290

    good post….i will use this for my website

    0
  31. 291

    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.

    0
  32. 292

    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. 293

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

    Thanks

    -4
  34. 294

    Darto KLoning

    March 9th, 2010 8:29 am

    wow, great job.

    0
  35. 295

    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. 296

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

    +1
  37. 297

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

    -1
  38. 298

    nice tutorial, thank’s

    -1
  39. 299

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

    -1
  40. 300

    Yogendra Ghorecha

    March 31st, 2010 5:36 am

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

    -5
  41. 301

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

    0
  42. 302

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

    Thanks !!

    0
  43. 303

    Good article .. Really helpful .

    Keep it up

    0
  44. 304

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

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

    0
  45. 305

    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. 306

    Thanks! This post is very helpful for me.

    0
  47. 307

    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. 308

    please tell me, how to create a table width css

    -9
  49. 309

    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;;;

    0
  50. 310

    Thanks, Very good article.

    0
  51. 311

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

    0
  52. 312

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

    0
  53. 313

    Nice Example of tables… :D

    0
  54. 314

    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.

    -2
  55. 315

    Great article… thanks a lot..

    0
  56. 316

    Yay tables!

    0
  57. 317

    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.

    -8
  58. 318

    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. 319

    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. 320

    asdas nice

    0
  61. 321

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

    +1
  62. 322

    i like that perfect and i think use my web site

    0
  63. 323

    very good! I like !

    0
  64. 324

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

    -12
  65. 325

    It’s very useful to me. Thanks

    0
  66. 326

    great article and very timely – thanks!

    0
  67. 327

    Perfect !!!

    0
  68. 328

    thank you. best sample

    0
  69. 329

    Just excellent!

    0
  70. 330

    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 ;)

    +3
    • 331

      TenLeftFingers

      July 13th, 2012 7:22 am

      Yeah, this html fails in the validator (http://validator.w3.org/check). But changing them from ID’s to classes should sort it out. If

      0
    • 332

      Really sure about it ? Although most of the information provided is true as per my knowledge but I don’t agree fully. I think it should be more practical. I visited your website while searching for your topic and hope to see more good information on it. Do keep up the good work.

      0
  71. 333

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

    0
  72. 334

    Thanks! This is great!!!!

    0
  73. 335

    really nice and great….. Salute to your hardwork

    +1
  74. 336

    srikanth portal

    December 12th, 2010 9:52 pm

    Nice designs..Thanks…

    +1
  75. 337

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

    +1
  76. 338

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

    +1
  77. 339

    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. 340

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

    +1
  79. 341

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

    -4
  80. 342

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

    +1
  81. 343

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

    +1
  82. 344

    These tables rock my world.

    +1
  83. 345

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

    +1
  84. 346

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

    +2
  85. 347

    Genius! Thanks!!

    +1
  86. 348

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

    -4
    • 349

      @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.

      +2
  87. 350

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

    +2
  88. 351

    awesome just what i needed….

    +1
  89. 352

    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. 353

    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. 354

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

    +1
  92. 355

    Dinesh Balendran

    March 27th, 2011 6:23 pm

    Awesome you are a champ!

    +1
  93. 356

    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. 357

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

    +2
  95. 358

    thanks for sharing

    +1
  96. 359

    Scott Foubister

    April 28th, 2011 2:30 pm

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

    +1
  97. 360

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

    +1
  98. 361

    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
  99. 363

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

    +1
  100. 364

    it’s special for me,thanks

    +1
  101. 365

    Nanang Gunawan

    June 9th, 2011 6:30 pm

    perfect table..

    thanks… very usefull….

    0
  102. 366

    supah cool…

    +1
  103. 367

    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. 368

    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. 369

    Jessica Nolhein

    June 21st, 2011 12:51 pm

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

    +1
  106. 370

    Awesome post man… :)

    +2
  107. 371

    Good Job Bro…

    +2
  108. 372

    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!

    +5
  109. 373

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

    +2
  110. 374

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

    only in pure css with no javascript ? ):

    0
  111. 375

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

    +3
  112. 376

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

    +2
  113. 377

    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.

    +2
  114. 378

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

    +2
  115. 379

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

    +2
  116. 380

    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.

    +3
  117. 381

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

    +3
  118. 382

    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.

    +2
  119. 383

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

    Thanks!

    +2
  120. 384

    thanks a lot! keep with this good job

    +2
  121. 385

    Very useful article .. thank you ..

    +2
  122. 386

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

    +2
  123. 387

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

    +2
  124. 388

    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 :)

    +2
  125. 389

    Thank u so much…..:)

    +1
  126. 390

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

    +1
  127. 391

    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.

    +2
    • 392

      .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;
      }

      +4
  128. 393

    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?

    +2
  129. 394

    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.

    +1
  130. 395

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

    +1
  131. 396

    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! :(

    +9
  132. 397

    The table’s css is not seen here…

    +4
  133. 398

    Thank you very much
    over all are nice.

    +1
  134. 399

    Thanks for the great post; I know you wrote it three years ago but it is still proving profoundly useful to me…

    +1
  135. 400

    Such an amazing article! :D
    Thanks a lot!

    +1
  136. 401

    Kismat Konnection

    April 19th, 2012 8:34 pm

    Thanks R. Christie for “Top 10 Express CSS Table Designs”. Its really Very Helpful, Thanks once again.

    +1
  137. 402

    Great work, Sir. It helps me a lot… Thank you very much.

    +1
  138. 403

    Just what I was looking for. Many thanks!

    -1
  139. 404

    It might be a bit late. But as I like being lazy, I see you want to add classes for certain effects.
    In stead of the even/odd class, you could be using tr:nthchild(even) and tr:nthchild(odd).
    The CSS2 standard also has :lastchild and firstchild pseudoclasses, which you can use for the rounded edges.
    Or even better:
    -moz-border-radius: 15px;
    border-radius: 15px;
    These round the borders without needing images. :-).

    +2
  140. 405

    great ,it help me so much .Keep do this

    0
  141. 406

    Great work! thank you very much for sharing!

    0
  142. 407

    I’m not seeing it on #5 & #6. There’s no column shading or anything.

    0
  143. 408

    Jose Luis Morales

    November 26th, 2012 7:40 pm

    Great, clean, minimalist, easy to integrate for my work proyects.

    Great work! thank you very much for sharing!

    From Venezuela.

    Happy day.

    0
  144. 409

    Why can’t i see the code of the #9 Table background?
    is this: 1
    * html table tbody td
    2
    {
    3

    4
    /* IE CSS Filter Hack goes here*/
    5

    6
    }

    all there is to it? If so can someone give me the css style of all the table?

    Thank you in advance.

    -1
  145. 410

    Matthias Kohlhoff

    January 25th, 2013 8:52 am

    Thanks for this great collection! I searched for it …

    -1
  146. 411

    Great! awesome! thanks :)

    0
  147. 412

    Awesome… Nice article for tables…

    0
  148. 413

    Thank you for the nice tutorial… God bless you more!!!

    0
  149. 414

    Thank you very much for the excellent and professional work you did :)… God bless!!

    0
  150. 415

    Outstanding article. Great job and beautiful tables.

    0
  151. 416

    Outstanding article!

    Thanks so much for taking the time to write and share.

    0
  152. 417

    Nice and easy, thanks

    0

  1. 1

    All seems fine except the chip on your shoulder thing

    +34
  2. 2

    SohoInteractive

    July 19th, 2009 5:07 pm

    Great collection
    Thanks you
    F.

    +13
  3. 3

    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! :(

    +9
  4. 4

    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.

    +6
  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.

    +5
  6. 6

    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!

    +5
  7. 7

    Sorry folks. Vitaly just fixed it.

    +4
  8. 8

    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

    +4
  9. 9

    .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;
    }

    +4
  10. 10

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

    +4
  11. 11

    The table’s css is not seen here…

    +4
  12. 12

    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 ;)

    +3
  13. 13

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

    +3
  14. 14

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

    +3
  15. 15

    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.

    +3
  16. 16

    Very useful article .. thank you ..

    +2
  17. 17

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

    +2
  18. 18

    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
  19. 19

    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.

    +2
  20. 20

    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
  21. 21

    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.

    +2
  22. 22

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

    +2
  23. 23

    @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.

    +2
  24. 24

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

    +2
  25. 25

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

    +2
  26. 26

    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.

    +2
  27. 27

    Good Job Bro…

    +2
  28. 28

    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.

    +2
  29. 29

    thanks a lot! keep with this good job

    +2
  30. 30

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

    +2

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