Click here to Skip to main content
11,412,833 members (73,334 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET CSS
how to give two css class to the one element ?
can this possible ??
Posted 14-Mar-13 7:51am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,

Yes, that's possible, just seperate all classes with a space in the class attribute:
<p class="first second third"> ... </p>
Read more here:
http://webdesign.about.com/od/css/qt/tipcssmulticlas.htm[^]

Hope this helps.
  Permalink  
Comments
Marcus Kramer at 14-Mar-13 14:00pm
   
My 5.
ProgramFOX at 15-Mar-13 12:08pm
   
Thank you!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can have more than one class for controls by separating them with space inside class attribute. But you cann't have more than one class attribute to any controls..

Ex: 1). Two classes
<div class="myclass1 mycalss2">content</div>
2). N number of classes
<div class="myclass1 myclass2 myclass3 ... ">content</div>

Note: If you written repeating style in both the classes they may get overwrite by each other.. So avoid repeating same styles.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 399
1 Sascha Lefévre 200
2 Maciej Los 180
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 110
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,317
2 Maciej Los 3,570
3 Abhinav S 3,298
4 Peter Leow 3,084


Advertise | Privacy | Mobile
Web02 | 2.8.150427.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100