The style attribute holds CSS declarations directly on an HTML element. Because those declarations target the element without a selector, they override declarations from a stylesheet or a style element. section 1.1.2
Making one navigation link orange
Add the declaration to the Specials link: <a href="/specials" class="featured" style="background-color: orange;">Specials</a>. The orange background applies only to that link and takes precedence over matching selector-based rules. section 1.1.2
Use the style attribute with these cascade rules in mind:
- Apply it when a declaration must affect one specific element directly. section 1.1.2
- Expect it to outrank declarations applied through CSS selectors in a stylesheet or a style element. section 1.1 section 1.1.2
- Override a normal inline declaration from a stylesheet only by using !important; avoid making inline declarations important, because nothing can override them. section 1.1.2
- Prefer moving the rule into a stylesheet when a reusable or easier-to-maintain approach is possible. section 1.1.2






