0

Question about CSS

so p#p01 { color:blue;} and #p01 { color:blue;} have the same results so the question is which is the correct way? With (p#p01) or without (#p01) and why is it the correct way?

7th Jun 2017, 5:40 PM
Justin Williams
Justin Williams - avatar
5 odpowiedzi
+ 2
#p01 is correct, because css rules applyed on id have highest priority, and also you can't have multiple elements with same ID, so p#p01 is pointless.
7th Jun 2017, 6:01 PM
Amar
Amar - avatar
+ 2
i think that both work. but there is just no reason to use first one
8th Jun 2017, 7:30 AM
Amar
Amar - avatar
+ 1
wait p#p01 is not correct actually
7th Jun 2017, 5:43 PM
_Retr0/-
_Retr0/- - avatar
0
they both displayed correctly in the test area on w3schools but thats the html tutorial and not html5. that could be why
8th Jun 2017, 1:09 AM
Justin Williams
Justin Williams - avatar
0
yeah I didn't think so
8th Jun 2017, 12:03 PM
Justin Williams
Justin Williams - avatar