Skip to main content
Inspiring
December 27, 2017
Answered

Why is Dreamweaver finding my ID instead of my Class?

  • December 27, 2017
  • 3 replies
  • 690 views

Why when I select a div I give a class and id to, then select my css under source, why is the selector showing the id instead of the class. Shouldn't it be showing the class in order for me to make changes in css?

This topic has been closed for replies.
Correct answer B i r n o u

to complete what said Nancy, just take a look there, we call that Specificity

Specificity - CSS | MDN

3 replies

rayek.elfin
Legend
December 29, 2017

Let's tie this in with the latest Star Wars hype!

specificitywars-05v2.jpg

PS the latest movie is really as bad as people are saying. Bombing a dreadnought in a no-gravity environment? And have they never heard of cruise missiles in the SW universe? Based on the self-destruct mission by one of the last tactical minds left in the rebellion (why is the general going down in her ship, when a droid could have sufficed, or perhaps have it remotely controlled?) a couple of cheap cruise missiles with installed hyper drives could pretty much destroy any opponent's ship at almost any size!

Sigh.

Nancy OShea
Community Expert
Community Expert
December 29, 2017

rayek.elfin  wrote

Let's tie this in with the latest Star Wars hype!

specificitywars-05v2.jpg

PS the latest movie is really as bad as people are saying. Bombing a dreadnought in a no-gravity environment? And have they never heard of cruise missiles in the SW universe? Based on the self-destruct mission by one of the last tactical minds left in the rebellion (why is the general going down in her ship, when a droid could have sufficed, or perhaps have it remotely controlled?) a couple of cheap cruise missiles with installed hyper drives could pretty much destroy any opponent's ship at almost any size!

Sigh.

Huh?  What in the universe has any of this to do with CSS IDs and Classes?

Nancy O'Shea— Product User & Community Expert
rayek.elfin
Legend
December 29, 2017

The chart expands on your answer. It's meant as a fun way to explain CSS specificity. The emperor represents an #ID selector, who is stronger in the force (specificity) than Darth Vader.

Too bad no-one expanded this chart with inline/external css rules and the !important statement. An inline !important CSS rule would be akin to the Death Star.

B i r n o u
B i r n o uCorrect answer
Legend
December 28, 2017

to complete what said Nancy, just take a look there, we call that Specificity

Specificity - CSS | MDN

Nancy OShea
Community Expert
Community Expert
December 28, 2017

ID has priority because it's unique to the page.

Class carries less importance.

What are you trying to do?

Nancy O'Shea— Product User & Community Expert