Click here to Skip to main content
13,000,324 members (74,522 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to give two css class to the one element ?
can this possible ??
Posted 14-Mar-13 6:51am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


Yes, that's possible, just seperate all classes with a space in the class attribute:
<p class="first second third"> ... </p>

Read more here:[^]

Hope this helps.
Marcus Kramer 14-Mar-13 14:00pm
My 5.
ProgramFOX 15-Mar-13 12:08pm
Thank you!
Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2017
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