Option to set multiple class

Discussion in 'CSS' started by deva.vvel, Jul 11, 2007.

  1. #1
    Is there any option to set multiple class on a single element. For example, I have two style sets defined as

    <style>
    .style1{text-decoration: none;}
    .style2{color: red;}
    </style>
    PHP:
    I tried to set both the style set for an element using class attribute as below. But it does not work. Is there any other option.
    
    <a href="" class="style1,style2">
    PHP:
    Thanks,
    deva
     
    deva.vvel, Jul 11, 2007 IP
  2. Dan_A

    Dan_A Peon

    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use class="style1 style2"
    This will only work with modern browsers.
     
    Dan_A, Jul 12, 2007 IP
    deva.vvel likes this.
  3. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #3
    I'm pretty sure it's well supported, the only problem being the multiple class selectors in your stylesheet and IE, for ex: .style1.style2 { } I think only the last class gets chosen.

    http://css-discuss.incutio.com/?page=MultipleClasses
     
    soulscratch, Jul 12, 2007 IP
    deva.vvel likes this.
  4. deva.vvel

    deva.vvel Guest

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks Dan_A and soulscratch..
     
    deva.vvel, Jul 12, 2007 IP