Tag Archive for: rule

Do not qualify ID rules with tag names or classes

css

If a rule has an ID selector as its key selector, don’t add the tag name to the rule.

Since IDs are unique, adding a tag name would slow down the matching process needlessly.

BAD

/* CSS */
button#backButton {…}

BAD

/* CSS */
.menu-left#newMenuIcon {…}

GOOD

/* CSS */
#backButton {…}

GOOD

/* CSS */
#newMenuIcon {…}