Reputation: 735
Generally speaking, an attribute selector has higher specificity than a type selector, but in the image below, the type selector wins (margin
is set to 0
)?
Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?
Upvotes: 1
Views: 279
Reputation: 723448
Is it because user agent stylesheet (browser default style) always gets overridden by custom CSS regardless of CSS specificity?
Yes. The technical name for "custom CSS" is author-level CSS as detailed in this section of the spec. Specificity is only relevant when you're comparing two CSS rules that have the same origin, either two UA styles or two author styles.
Upvotes: 1