Which one gets the highest priority: class or id? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which one gets the highest priority: class or id?

Suppose I have given class and id both the attribute to p tag (<p class="style1" id="style2">) and applied different styles in style1 and style2, which one will affect the document.

28th Aug 2016, 7:40 PM
Dipak Kumar Prasad
Dipak Kumar Prasad - avatar
1 Answer
+ 4
ID has a higher priority, you can find all of the priority levels online, you can also change them manually.
28th Aug 2016, 8:52 PM
Frank Gunsch
Frank Gunsch - avatar