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
| SitePoint Sponsor |
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
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
No, the correct way is to apply both classes to one span!Originally Posted by tunnel7
You can put more than one CSS class in an element, as long as you separate each class name with a space.HTML Code:<span class="red sml">Text</span>
as easy as that! I tried semi colons, commas, small furry creatures, you name it!!!Originally Posted by vgarcia
Cheers both!
monkey - the rest is history
Bookmarks