本文介绍了作者的风格,读者的风格,代理的风格(或作者,用户,用户代理风格)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一书中,第3章是关于 The Cascade 这本书说:

我有两个问题要问:



  • 在CSS中,作者风格读者风格代理style


  • 根据这本书的上述文字,作者风格读者的风格读者风格的强于作者风格


  • 解决方案

    1. 用户代理是应用程序如Chrome或Firefox),您正在查看的网站。用户代理具有默认样式表。您可以使用Chrome的开发人员工具功能来检查其属性。



      读者是浏览您网站的网络冲浪者。您网站的访问者可以选择设置自己的样式表或自定义规则(例如系统颜色或字体首选项)。



      作者的样式表是网站本身的HTML中明确链接的样式表。也就是说,它是你创建的。


    2. 通常,出于良好的原因,作者样式表优先于用户代理和阅读器样式表。但是,读者可以选择设置作者不能覆盖的样式。这也是很好的理由,因为视觉障碍或其他辅助功能问题的人需要在所有网页上设置特定样式。



    In the book "CSS the definitive guide" , Chapter 3 which is about "The Cascade" , the book says:

    I got two questions to ask:

    1. In CSS, What are author's style , reader's style and agent's style?? I really get confused about there three concepts.

    2. According to the above words from the book, seems author's style is stronger than reader's style, but why with !important indicator, 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

    解决方案
    1. 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.

    2. 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.

    这篇关于作者的风格,读者的风格,代理的风格(或作者,用户,用户代理风格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    08-01 01:58