can you make a <p> with multiple classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

can you make a <p> with multiple classes

24th Oct 2016, 6:19 AM
Djaro
Djaro - avatar
15 Answers
+ 8
yes, multiple class names must be separated by white space characters. Just put a space between them. For example: <p class="class1 class2 class3">Multiple classes</p>
25th Oct 2016, 4:24 AM
Andrés Ceballos Sánchez
Andrés Ceballos Sánchez - avatar
+ 6
yeah, just make a dive and give it multiple classes! like this: <p class="class1" class="class2">p tag with multiple classes</p>
24th Oct 2016, 12:05 PM
babakm
babakm - avatar
+ 4
<p class="class1 class2 class3">Multiple class</p>
15th Jan 2017, 11:26 AM
Firouze
Firouze - avatar
+ 3
you can define one or more clases to a tag, NOT only a div, it can be any tag inside the body, including body. example: <p class="class1 class2 class3 class4">multiple classes in a tag</p>
27th Oct 2016, 6:40 AM
Jorge Escamilla
Jorge Escamilla - avatar
+ 1
The choice of a div or p depends on what you want to do with it. div can help to keep other tags together that form a structural unit. ex. you can position all the elements of a sidebar in one div and a p tag holds simply the text of one paragraph together
27th Oct 2016, 8:48 PM
Richert Van Impe
+ 1
yes.. <p class="1" </p><p>class="2"</p>
28th Oct 2016, 4:26 AM
Jamiul Alam Rejon
Jamiul Alam Rejon - avatar
0
@babakm why a div, can't I just do it in the <p> tag? [update. this question is not relevant anymore]
26th Oct 2016, 12:09 PM
Abraham Jacobowitz
Abraham Jacobowitz - avatar
0
@babakm said "dive", meaning that @Djaro should go ahead and try it. You can give multiple classes to any html tag
28th Oct 2016, 11:29 AM
Lucas Araujo
Lucas Araujo - avatar
0
@lucas I see now my mistake, thanks for clarifying that
28th Oct 2016, 1:06 PM
Abraham Jacobowitz
Abraham Jacobowitz - avatar
0
you're welcome :)
28th Oct 2016, 1:24 PM
Lucas Araujo
Lucas Araujo - avatar
0
Yes absolutely
14th Nov 2016, 7:59 PM
Abdul-lateef Muhammad
Abdul-lateef Muhammad - avatar
0
is it good to use multiple class name in a single tag?
3rd Dec 2016, 8:12 AM
riku
riku - avatar
0
Yes,obviously.
5th Dec 2016, 6:21 PM
Abdul-lateef Muhammad
Abdul-lateef Muhammad - avatar
0
yeah
11th Jan 2017, 9:59 AM
Kinjal Suryavanshi
Kinjal Suryavanshi - avatar
0
yes why not
18th Jan 2017, 8:45 AM
Yash Parmar
Yash Parmar - avatar