In the book "CSS the definitive guide" , Chapter 3 which is about "The Cascade" , the book says:
There are three origins: author, reader and user agent. Under normal
circumstances, the author’s styles win out over the reader’s styles.
!important reader’s styles are stronger than any other styles,
including !important author styles. Both author and reader styles
override the user agent’s default styles.
I got two questions to ask:
-
In CSS, What are author’s style , reader’s style and agent’s style?? I really get confused about there three concepts.
-
According to the above words from the book, seems author’s style is stronger than reader’s style, but why with
!importantindicator, the reader’s style is stronger than author’s style?? I get confused about this.
There’s another terminology for this: author, user and user-agent styles
The user agent is the application (usually a browser, such as Chrome or Firefox) that you are viewing the website with. User agents have a default stylesheet. You can inspect its properties with a tool like Chrome’s Developer Tools feature.
The “reader” is the web surfer viewing your site. Your site’s visitors can optionally set their own stylesheets or custom rules (such as system colours or font preferences). They might do this out of personal preference, or because they have accessibility requirements.
The author’s stylesheet is the one explicitly linked to in the HTML of the website itself. I.e., it’s the one that you created.
Normally, for good reason, the author stylesheet takes precedence over user agent and reader stylesheets. However, readers have the option to set styles that authors can’t override. This is also for good reason, as people with visual impairments or other accessibility issues will need certain styles to be set across all pages.