HTML tag question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

HTML tag question

what does the <p class="first"> indicates and means?

12th Aug 2020, 4:38 AM
Vishal Pandey
6 Answers
+ 11
Class ="first" indicates you can use in CSS code for design. For example .first { padding : 10 px solid; margin :10 px; text-align : center; font-size : 20 px }
13th Aug 2020, 12:24 AM
💜💜Lucy2808💜💜
💜💜Lucy2808💜💜 - avatar
+ 5
No visual difference would be seen between; <p>Hello</p> And <p class="first">Hello</p> But now you can select the second <p> with its class name, inside of javascript and css. CSS: .first { color: white; background: #1c1c1c; padding:10px; } JAVASCRIPT: document.querySelector(".first") If it was an id instead of class, you would have to use #first instead of .first ids must me unique, classes can be similar, such as you can provide a class name "video" to all the elements and go to css and create styles for ".video" and all elements with class of video would change in appearance.
12th Aug 2020, 4:56 AM
maf
maf - avatar
+ 3
Thank you
12th Aug 2020, 5:37 AM
Vishal Pandey
+ 3
Sara Phoebe class="first" indicates that you can give the p tag css like color, background-color, position, border etc with .first in css and if you want to do same styling with other elements instead of writing whole again you can just write class="first" in html element where you want to style In that case class attribute is used
12th Aug 2020, 5:49 AM
Himanshu Shah
Himanshu Shah - avatar
+ 3
Himanshu Shah thank you
12th Aug 2020, 7:53 AM
Vishal Pandey
13th Aug 2020, 3:14 AM
Vishal Pandey