Forum:Table design with CSS

Is it possible to define different styles for each table column without adding every cell to a style class?

Example: An easy solution is and defining the colors in the used style classes.

But is it possible to define this table design using only a single class for the but it doesn't work.


 * with CSS:

 .mytable a { color:green !important; }

.mytable { color:yellow; }
 * -- Weas-El ✉  15:21, September 28, 2011 (UTC)

Sorry, but I don't think that would work, simply because we have tons of tables with different colorschemes and we set the colorscheme through a template, this way we have to edit only the template to affect every object which use that colorscheme. If I have to set a class for every tables, than it's faster set the colors manually, also I don't think I can use wiki text and template in the CSS.

I mean we do somethink like this:

Though a little more complicated...


 * f you don't want to add a specific CSS class to all the tables where you want to modify the link color, then you can be more general about the selector, i.e.



table td a { color:yellow !important; }


 * which will change the link colors for ALL tables on your wiki. You can also be more specific by adding a other selectors to specify which tables you want to colorize. There needs to be a 'hook' for them though - something that distinguishes them from other tables.


 * Generally, using templates just to add styling causes more server strain than just defining it through the wiki style sheets, so the solution Weas-El suggested is in my opinion the better one. — Sovq 16:41, September 28, 2011 (UTC)

If you want an idea how we use the colorschems, see here. We use them for infoboxes, template and other things. Well I guess there isn't any other solution, thank you.


 * 104 templates just to provide color schemes!?!?!?!? That's crazy! They all have almost the same content and they could easily be put in a single template with a switch.


 * Another approach is to use a generic class and a specific class. In the generic class you define things that are common to most tables (or whatever element you are styling), things like margins and borders. In the specific class you define things like colors, boldness, italics, etc...
 * You'd use
 * If you want the color scheme to come from a template you can use  and in CSS define a section called table-name_of_scheme.


 * The big difference between using global CSS and templates is that normal users can create and edit templates but not the global CSS.