Jump to content


Photo

multiple classes


  • Please log in to reply
3 replies to this topic

#1 earl_dc10

earl_dc10
  • Members
  • PipPipPip
  • Advanced Member
  • 71 posts

Posted 18 March 2006 - 10:01 PM

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:

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

// and then

<td class="1" class="2"></td>

got a problem? Google helps many of those in need

#2 Javizy

Javizy
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 18 March 2006 - 10:35 PM

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...

table.parent {
}

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

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

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


#3 earl_dc10

earl_dc10
  • Members
  • PipPipPip
  • Advanced Member
  • 71 posts

Posted 18 March 2006 - 11:01 PM

ok, thanks!
got a problem? Google helps many of those in need

#4 theverychap

theverychap
  • Staff Alumni
  • Advanced Member
  • 78 posts
  • LocationDevon, England

Posted 19 March 2006 - 12:07 AM

totally possible, just use:

<td class="1 2">...

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 ;~)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users