Forum:Custom table CSS not working as expected

Hi, folks. I've created a custom CSS class to be used for some of my tables. Then when I create a table, I specify the class. The reason I'm using an HTML table instead of a mark up one is that I came down to that trying to debug the problem. It doesn't really matter, the mark up table works the same way.

Here is the CSS stored in MediaWiki:Wikia.css. /* === Mourne tables === */ table.Mourne { border-collapse: collapse; border: 2px solid black; padding: 0; margin: 0; } td.Mourne, th.Mourne { border: 1px solid black; padding: 12px; margin: 12px; } th.Mourne { background-color: orange; font-weight: bold; font-size: 125%; }

And here is the table on a page. Now, the first table row uses some default formatting, while the second row uses my custom as defined in the Mourne class. The problem is that I expect the table's elements use the class specified in the table tag itself. For everything I've created regarding HTML/CSS/PHP etc., I don't remember that I ever needed to specify the class for every single element of a table. The class Mourne should be used for all elements of the table. Right?

But it doesn't. What might be the problem here? Thank you in advance. Dulha 20:43, October 17, 2011 (UTC)


 * Elements have never inherited the classes of their parents - they can, however, be selected using those classes in CSS. Instead of, use  , which means all   elements inside any element with class  . In this case, the element with class   is the table.   is equivalent, if you prefer to use that instead.


 * Thank you very much. I suspected something like that, but when I was writing a web page for a friend not that long ago, I used tables and their elements the way I described and they worked. Can't really say how that is possible. That's why I thought it should work. Anyway, again, thank you for a quick reply. Dulha 20:54, October 17, 2011 (UTC)