Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Priority in CSS when both id and tag are selected?

If the priority of the id selector in css is the highest, why are the background colors of the two p’s (test1 and test2) are same blue?

enter image description here

I have tried to change the order of selectors in the style code block and ways to express the id selector. like p #123 {} and #123 p {} .

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I want to know the principle and how to use the id selector correctly in this case.
Thank you very much.

>Solution :

Your mistake is naming id.
You must name id without numbers (change it to some word i.e test) and it works.
enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading