Why is id selector using div and intro resulting to gray backgroundcolor? While class selector used class="first" ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is id selector using div and intro resulting to gray backgroundcolor? While class selector used class="first" ?

I'm confused

11th Nov 2021, 6:37 PM
Bala Didi Nwaozor
Bala Didi Nwaozor - avatar
2 Answers
0
Can you please link your code? Without seeing the code, we don't know which ids and classes there are
11th Nov 2021, 7:00 PM
Lisa
Lisa - avatar
0
Answering based on assumption: In CSS, id takes higher precedence than class. Properties written in class for a element is always overwritten by the properties written in a id for the same element. Use !important to give class higher precedence.
11th Nov 2021, 10:47 PM
Zubae
Zubae - avatar