Forum:How do you use the class attribute within a table?

The WikiText for Hotel Profit Chart makes a number of references to class="x###" where "###" has several different values. I thought that using a class within a table meant that the class needed to be defined within the Monaco.css file. When I looked at that file though, it did not contain any references to the 'x-classes'.

I'd appreciate any enlightenment on how these types of classes should really be used. I checked at http://meta.wikimedia.org/wiki/Help:Tables#Style_classes and http://meta.wikimedia.org/wiki/Help:User_style but didn't see anything definite there as to how to properly use this feature.

Mrjoeterrace 21:34, June 18, 2010 (UTC)
 * Classes aren't strictly for CSS. They are a means by which CSS is applied, but not dedicated to CSS - for instance JavaScript (especially with the jQuery library) can reference HTML elements by classes.  Hope that enlightens you. -- 21:51, June 18, 2010 (UTC)


 * Okay, but if you have a class="x165" in your table description for a cell, how does that get activated? Mrjoeterrace 22:37, June 18, 2010 (UTC)
 * On that example, they aren't doing anything. You could remove them and the table would look the same. -- 23:07, June 18, 2010 (UTC)
 * Right. So how would you use this so that it had some effect?  Mrjoeterrace 23:15, June 18, 2010 (UTC)
 * Define it in MediaWiki:Monaco.css as you said: .x165 { background-color:red; }
 * Etc. -- 00:00, June 19, 2010 (UTC)


 * Just to expand a bit, if you use a class like, it needs to appear as   in the CSS file/page. For an id like  , it needs to appear as   in the CSS file/page. Also, inline styles like   have precedence over ids and ids have precedence over classes. So you have to look carefully to make sure something you didn't notice is overriding a change you tried to make. --  Fandyllic  (talk &middot; contr) 1:33 PM PST 19 Jun 2010