SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2 styles in one span

    How do I attatch 2 different styles to a single span - I have a style .red and a style .sml and I want the text in my span to be small and red - is this possible or do I need a .smlandred style?

    Monkey
    monkey - the rest is history

  2. #2
    SitePoint Enthusiast tunnel7's Avatar
    Join Date
    Oct 2002
    Location
    Easthampton, MA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could apply both classes in two span tags:

    <span class="small"><span class="red">text</span></span>

    However, if it was me I'd create a separate class. The reason being that down the road if you want to change one of those classes it could affect this double span adversely. If you have one new class it will be safe from changes to the other classes.
    Tunnel 7 | Standards Based Website Design
    http://www.tunnel7.com

    Follow me: http://www.twitter.com/derekallard

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by tunnel7
    you could apply both classes in two span tags:

    <span class="small"><span class="red">text</span></span>

    However, if it was me I'd create a separate class. The reason being that down the road if you want to change one of those classes it could affect this double span adversely. If you have one new class it will be safe from changes to the other classes.
    No, the correct way is to apply both classes to one span!
    HTML Code:
    <span class="red sml">Text</span>
    You can put more than one CSS class in an element, as long as you separate each class name with a space.

  4. #4
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    No, the correct way is to apply both classes to one span!
    HTML Code:
    <span class="red sml">Text</span>
    You can put more than one CSS class in an element, as long as you separate each class name with a space.
    as easy as that! I tried semi colons, commas, small furry creatures, you name it!!!

    Cheers both!
    monkey - the rest is history


Bookmarks

Posting Permissions

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