Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts

    setting two values to the class attribute

    Simple really, I'd like an element to have two class values.
    I tried this:
    Code:
    <a href="#" class="class1" class="class2">link</a>
    but it doesn't validate (and for obvious reasons).

    So is my only solution to create a third class that combines the two?

    Thanks
    Shawn

  • #2
    New Coder
    Join Date
    Aug 2004
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Separate classes with a space and you are cookin' with gas.


    Code:
    .class1 { background: #fff; }
    .class2 { font-family: arial,sans-serif; }
    .class3 { color: #000; }
    
    ...
    
    <div class="class1 class2 class3">
         ...content...
    </div>

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    ohhhhhhh, thanks much.
    Shawn


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •