Forum:Use css to make table column not display whenever table is inside div with class x

Lets say I have a table with 2 columns where every cell in column one belongs to class "chartcolumn1" and every cell in column two belongs to class "chartcolumn2". I want to transclude the whole table between 2 div tags where the div belongs to class "onlycolumn2". In css I want to make it so that only column 2 displays when the table in inside a div of that class. Then sometimes I will transclude the table between div tags with class "onlycolumn1". I thought it would be a simple matter using something like: .onlycolumn2 .chartcolumn1 { display:none !important; } That didnt work and I have no idea why. The actual table I am working with is a little more complicated than this. It has more than 2 columns and sometimes I might want to display 2 or more columns at one time. But this is the main idea.

Granpa (talk) 20:09, November 3, 2012 (UTC)


 * Nevermind.
 * This is the right code.
 * I just made a mistake in the coding of the table.
 * Thats why it wasnt working.
 * Granpa (talk) 21:18, November 3, 2012 (UTC)