OZONE Asylum
FAQ
Can I use more than one/multiple class for an element?
This page's ID:
5551
Search
QuickChanges
Forums
FAQ
Archives
Register
You are editing "Can I use more than one/multiple class for an element?"
Who can edit an FAQ?
Anyone registered may edit an FAQ.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
The simple answer is yes you can use multiple classes - the trick is using this correctly. To quote Slime: [quote]There are a few errors in DL's post that should be noted: <div class="8877" class="shoppingCartItem"> displays item in side bard shopping cart style</div> This is incorrect; the correct syntax is: <div class="8877 shoppingCartItem"> displays item in side bard shopping cart style</div> (Note that the multiple classes are separated by spaces.) Secondly, neither an ID nor a class may begin with a number. So 8877 is neither a valid ID nor a valid class name. Change it to something like "itemNumber8877" or something.[/quote] However, you can only have one id: [quote]while the id="" attribute can only have one value, and that value must be different from all other IDs in the page, the class="" attribute can have *multiple, space separated* values. For instance: .happy {font-style:italic; font-color:#F88;} .evil {font-family:FontOfEvilness;} ... <p class="happy">I'm the good guy</p> <p class="evil">I'm the bad guy</p> <p class="evil happy">I'm the bad guy after eating the good guy</p>[/quote] ----------------------------- Relevant threads: [url=http://www.ozoneasylum.com/Forum8/HTML/000499.html]class VS id what is the difference[/url] [url=http://www.ozoneasylum.com/Forum8/HTML/000376.html]some questions on css[/url] ----------------------------- Relevant links: [url=http://dhtmlnirvana.com/content/classmulti/cssmulti1.html]CSS Multiple Classes on Elements[/url] [url=http://www.webreference.com/authoring/style/sheets/multiclass/]Using Multiple CSS Classes on Elements[/url] ------------------------- Relevant FAQs: [internallink=5534]What is the difference between an ID and a class in CSS?[/internallink] ______________________ [internallink=4626]Emperor[/internallink] [small][i](Added by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Emperor]Emperor [/url] on Sat 08-Feb-2003)[/i][/small] [small][i](Edited by: [url=http://www.ozoneasylum.com/cgi-bin/ubbmisc.cgi?action=getbio&UserName=Emperor]Emperor [/url] on Sat 08-Feb-2003)[/i][/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »