Three style sources in CSS: creators, readers, and user agents

Source: Internet
Author: User

There are three types of styles in CSS: creators, readers, and user agents, different sources can affect how styles are stacked.


First of all, the creator (author ' S+style) style should be the most familiar to us, if you are a front-end developer, then the styles you write are called the authoring style.

Then is the user agent style (agent ' S+style), the user agent is what we usually say the browser (IE, Firefox, etc.), these browsers will provide some default style, such as Internet Explorer, a purely HTML-coded Web page, We will find that the hyperlink will have a blue foreground color, in fact, the user-agent style, borrowing some plugins we can easily view these default styles (such as Web+developer in Firefox)

Finally, the reader's style (reader ' S+style) is also the easiest to overlook. The so-called readers are naturally browsing the Web users, sometimes these users may not be satisfied with the color of the page, or font size, this time they are through the interface provided by the browser for the site to add reader style.

After the introduction of the source, let's take a look at how to sort by weight and source, based on the weights summarized in the CSS authoritative Guide (third edition P79):

1.+ the style of the author +>+ The style of the reader +>+ the default style of the user agent

2.+ tag for reader style of important declaration (!important) +>+ all styles

Some friends may not understand at first the meaning of the second, in fact, it is a good choice of CSS provides a mechanism, that is, usually, the author style will have the greatest weight, which is what developers want to see, but the user has the ultimate choice, you can pass! Important overrides any style that you want to overwrite.

Three style sources in CSS: creators, readers, and user agents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.