+ 6
HTML tag question
what does the <p class="first"> indicates and means?
6 odpowiedzi
+ 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
}
+ 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.
+ 3
Thank you
+ 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
+ 3
Himanshu Shah thank you
+ 2
💜💜Rachel2808💜💜 thanks dear