Jump to content

Archived

This topic is now archived and is closed to further replies.

earl_dc10

multiple classes

Recommended Posts

hey, Im wondering if I can have more than one class for an element, I have links on my page which I want to have all the same attributes, but each one have a unique setting so to speak. simplified example:

[code]
td.1
{
   background-color: black;
}
td.2
{
   border-style: solid;
}

// and then

<td class="1" class="2"></td>
[/code]

Share this post


Link to post
Share on other sites
I've never come across a situation where I've needed to do something like that, and as far as I know it's not possible.

I would do it like this...

[code]
table.parent {
}

table.parent td {
  /* set defaults */
}

table.parent td.1 {
  /* set specific 1 */
}

table.parent td.2 {
  /* set specific 2 */
}
[/code]

Share this post


Link to post
Share on other sites
totally possible, just use:

[code]<td class="1 2">...[/code]

and styles from both classes will be applied...

it does get more complicated depending on specificity and styles declared but thats enough for you to be getting on with ;~)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.