What the function of attribut class= ? Plz reply... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What the function of attribut class= ? Plz reply...

20th Oct 2017, 1:39 PM
Masked Man
2 Answers
+ 1
The class attribute is used to attach or define a class for a specific tag. So within your CSS stylesheet you could say .mystyle which has a background colour red. Then the div tag or p tag etc you can add <div class="mystyle">. class is different from id, so although you can still style something using the id of an element by using #mystyle, this is bad practice as the id is for referencing something where as the class attribute is for attaching a style directly to it. <div id="headerbox" class="headerstyle"></div> .headerstyle { height:200px; width:100px; background-color:#ff0000; } Hope that helps.
20th Oct 2017, 1:55 PM
ihateonions
0
thanks...
20th Oct 2017, 2:01 PM
Masked Man