Current location: Hot Scripts Forums » General Web Coding » CSS » Two classes together


Two classes together

Reply
  #1 (permalink)  
Old 01-27-09, 01:30 AM
ajit22 ajit22 is offline
Newbie Coder
 
Join Date: Jan 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Two classes together

Usually attributes are assigned just one class, but this doesn't mean that that's all you're allowed. In reality, you can assign as many classes as you like! For example:

<p class="text side">...</p>

Using these two classes together (separated by a space, not with a comma) means that the paragraph calls up the rules assigned to both text and side. If any rules overlap between the two classes then the class which is below the other in the CSS document will take precedence.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-27-09, 06:02 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Quote:
If any rules overlap between the two classes then the class which is below the other in the CSS document will take precedence
Isn't this different for IE and FF? I will look into that. Thought that IE looks at the first one.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-27-09, 08:41 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
if .text says border:1px solid #000; and .side says border:2px solid #000;

Then you have this element:
<p class="text side">...</p>

Then the element will end up with a 2px border, regardless which browser you view it in.
__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-27-09, 09:12 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Tried it and guess you are right. IE6, IE7 and FF all show the same. I can't test on FF 2 anymore though. Somehow I thought I remembered there was a difference, but guess not.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Classes Nebulous PHP 2 11-01-08 05:47 PM
Classes and Timer Jay6390 Visual Basic 2 12-24-07 07:44 AM
Girl with no clue!!!!Booking Classes PHPMYSQL jobless1 Script Requests 0 07-13-07 04:56 AM
Use Graphics classes in a class library RFickling Windows .NET Programming 0 01-15-05 03:07 PM
language classes for VC++6.0 adruta C/C++ 3 06-05-04 09:39 AM


All times are GMT -5. The time now is 12:19 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.