Stylesheet origin is the cascade criterion that identifies where a declaration comes from. Browsers combine author styles, user styles, and user-agent styles when resolving conflicts. section 1.1 section 1.1.1
The three stylesheet origins have different priorities:
- Author styles are declarations added to the page and normally override browser defaults. section 1.1.1
- User styles are end-user customizations positioned between user-agent and author styles; they are uncommon and may require browser support or extensions. section 1.1.1
- User-agent styles are browser defaults, such as heading margins, list padding and bullets, link colors, and default font sizes. section 1.1.1
Replacing browser defaults
A page header initially receives browser-provided list padding, bullets, link colors, and underlines. Author rules can replace those defaults by removing list styling and padding, displaying navigation items inline, and assigning custom link colors, backgrounds, spacing, and decoration. section 1.1.1
Listing 1.3 Overriding user-agent styles
h1 {
color: #2f4f4f;
margin-bottom: 10px; #1
}
#main-nav {
margin-top: 10px; #1
list-style: none; #2
padding-left: 0; #2
}
#main-nav li {
display: inline-block; #3
}
#main-nav a {
color: white; #4
background-color: #13a4a4; #4
padding: 5px; #4
border-radius: 2px; #4
text-decoration: none; #4
}
Inspect the CSS declarations that override user-agent styles on a navigation menu and its links. section 1.1.1
