3岁属什么生肖| 蔓越莓有什么功效| 糖耐量受损是什么意思| 优对什么| 军长相当于地方什么官| 女人补铁有什么好处| 七月八日是什么日子| 朋友生日送什么礼物好| 蟑螂长什么样子| 干预治疗是什么意思| 左肺下叶钙化灶是什么意思| 什么的池水| 白带清洁度lv是什么意思| 老三篇是什么意思| 尿酸高不能吃什么东西| 道家思想的核心是什么| 全身发烫但不发烧是什么原因| 什么样的雨珠| 意什么深什么| 苹果煮水喝有什么功效| 心脏突然剧烈跳动是什么原因| 血管瘤是什么引起的| 为什么会得胆结石| 排卵期出血是什么原因| 角化型脚气用什么药膏| 西安什么省| 男人吃什么大补| 荒淫无度是什么意思| 空调输入功率是什么意思| 吃什么能让阴茎更硬| 四点底和什么有关| 陈旧性心梗是什么意思| 做梦梦到小孩子是什么意思| 老打饱嗝是什么原因| 减肥吃什么食物瘦得快| 嗜酸性粒细胞偏低是什么原因| 咳喘是什么原因| 9月10日什么星座| 属猴本命佛是什么佛| 紫荆花的花语是什么| 节瓜煲汤放什么材料| 林五行属什么| 眩晕是怎么回事是什么原因引起| 诸多是什么意思| 鱼精是什么| 90年属什么| 单抗主要治疗什么| 溲黄是什么意思| px是什么| 竹子开花意味着什么| 吃什么消肿| 什么是制片人| 中国在什么半球| 吉代表什么生肖| eft是什么意思| 芒果有什么营养价值| 女人胸疼是什么原因| 菜花是什么病| 点背是什么意思| 肚脐眼上方是什么器官| 龙虾不能和什么一起吃| 胸疼挂什么科| 霉菌性阴道炎用什么药效果好| 苏轼的弟弟叫什么| 心脏搭桥和支架有什么区别| 糖类抗原什么意思| 女性多囊是什么意思| 这是什么踏板| st是什么意思| 抛砖引玉是什么生肖| 眼角长痘痘是什么原因| 倾诉是什么意思| 为什么越睡越困| 贫血用什么药补血最快| 口红是用什么做的| 年轻人为什么会低血压| 鲫鱼是什么鱼| 氰化钾是什么| 小米是什么米| 什么的水| 约炮什么意思| 太上老君的坐骑是什么| 精油是什么| 来例假吃什么好| 小狗的尾巴有什么作用| 甲状腺与甲亢有什么区别| 一卡通是什么| 为什么流鼻血| 吃饭的时候恶心想吐是什么原因| 什么是腐女| 合龙是什么意思| 退休是什么意思| 梦见吵架是什么预兆| 不良资产是什么| 早上起来眼睛肿了是什么原因| 看什么| 痄腮是什么意思| 亥时右眼跳是什么预兆| 气管憩室是什么意思| 血液肿瘤是什么病| 去阴虱用什么药最好| 后脑勺出汗多是什么原因| 尿检4个加号什么意思| 失眠睡不着是什么病| 生僻字是什么意思| 天麻加什么治头晕| 左氧氟沙星的功效是什么| 什么样的女人不能娶| 着数是什么意思| 兰州人为什么要戴头巾| 羊驼为什么吐口水| 大便不成形吃什么食物好| 靶身高是什么意思| 高脂血症是什么意思| tv是什么意思| 什锦菜是什么菜| 7月22日是什么星座| 深度睡眠是什么状态| 什么快递比较快| 出库是什么意思| 右下腹疼痛什么原因| 大便次数少是什么原因| 奴才模样是什么生肖| 白化病有什么危害吗| 错位是什么意思| 肚子长痘痘是什么原因| 大泽土是什么生肖| 腐男是什么意思| 五月初九是什么星座| 老是放屁是什么原因| 六三年属什么生肖| 查电话号码打什么电话| 刘晓庆为什么坐牢| 龟头瘙痒用什么药膏| 戳什么意思| 贫血吃什么食物好| 耳膜穿孔是什么症状| 疏离感是什么意思| 婚检女性检查什么项目| 朝鲜面是什么原料做的| 吃小米粥有什么好处和坏处| 要什么| 刘亦菲为什么不结婚| 射频是什么| 媱字五行属什么| 男孩学什么技术最好| 大小三阳是什么病| 切忌是什么意思| 甘油三酯高有什么危害| 鱼油吃多了有什么副作用| 孕妇吃海带有什么好处| 吃什么降火| 74年属什么的生肖| 子宫粘连是什么原因引起的| 22是什么意思| davena手表什么牌子| 黄芪什么味道| 心脏不舒服挂什么科室| 纳财是什么意思| 国际章是什么意思| 为什么要打胰岛素| 人乳头瘤病毒是什么病| 不放屁是什么原因| 张韶涵什么星座| 手抖看什么科| 哈尔滨机场叫什么名字| bally什么牌子| 指疣是什么病| 一什么鸟窝| 狐臭看什么科| 民族是什么意思| 红细胞计数偏高是什么意思| 先什么后什么| 痛经是什么原因| 罗汉果泡水有什么好处| 9月1号什么星座| 知更鸟是什么鸟| 海参吃了有什么好处| 种什么最赚钱| 为什么蝙蝠会飞进家里| hardy是什么意思| 梨的功效与作用是什么| 2.1是什么星座| 生肖狗和什么生肖相冲| 芈月传芈姝结局是什么| 澄字五行属什么| 渣滓是什么意思| 模特是什么意思| 吃什么可以减肥| 月经来潮是什么意思| 什么情况下做试管婴儿| 小孩表演后卸妆用什么| 林黛玉和贾宝玉是什么关系| 口腔检查挂什么科| 为什么偏偏喜欢你| 四月十四日是什么节日| 区长是什么级别的干部| 囊肿是什么病严重吗| 尿出来很黄是什么原因| 干呕是什么病的前兆| caring什么意思| 异性缘是什么意思| 口嗨是什么意思| 身份证照片穿什么颜色衣服| 软禁是什么意思| 三个六代表什么意思| mac是什么意思啊| 嗓子总有痰吃什么药| 西红柿可以做什么菜| 2010属什么生肖| 龙龟适合什么属相人| 阑尾炎输液输什么药| 身份证号后四位代表什么| 滑脉是什么意思| semir是什么牌子| 中子是什么| 牛欢喜是什么| 不宁腿是什么症状| 金针菇炒什么好吃| 记忆力不好是什么原因| 印度是什么人种| 什么是淋巴肿瘤| 眼睛发炎用什么眼药水| art是什么| 5月11日什么星座| 烂仔是什么意思| 督邮相当于现在什么官| 舌头尖有小红点这是什么症状| 为什么的拼音怎么写| 磷脂是什么| 什么是三有保护动物| 突然血糖高是什么原因引起的| 尿酸高吃什么好| 睡觉经常做梦是什么原因| tid是什么意思| 得济是什么意思| 附件炎有什么症状| 山东登州府现在叫什么| 舌尖疼吃什么药| 男人练臀桥有什么用| 掉头发去医院看什么科| her什么意思| 手癣是什么原因引起的| 伤口消毒用什么好| 什么是理科什么是文科| 破关是什么意思| 检查全身挂什么科| 7月1日是什么节| 肠易激综合征吃什么药好| 昙花一现什么意思| 老心慌是什么原因| 失落是什么意思| 14年属什么| 欺世盗名是什么意思| 鼻子干燥吃什么中成药| 狮子座是什么象星座| 王字旁一个行念什么| 什么是心脏造影| 早上起来不晨勃是什么原因| 青出于蓝是什么意思| 胸口闷闷的有点疼是什么原因| 姓黑的都是什么族| 儒雅什么意思| 男人肾虚吃什么补得快| 百度

故宫停售“俏格格娃娃” 已售出的一律退款召回

百度 除此之外,植物园属于重点防火单位,燃放烟饼,为园林消防安全埋下了隐患。

Contents

Note: Several sections of this specification have been updated by other specifications. Please, see "Cascading Style Sheets (CSS) — The Official Definition" in the latest CSS Snapshot for a list of specifications and the sections they replace.

The CSS Working Group is also developing CSS level 2 revision 2 (CSS 2.2).

6.1 Specified, computed, and actual values

Once a user agent has parsed a document and constructed a document tree, it must assign, for every element in the tree, a value to every property that applies to the target media type.

The final value of a property is the result of a four-step calculation: the value is determined through specification (the "specified value"), then resolved into a value that is used for inheritance (the "computed value"), then converted into an absolute value if necessary (the "used value"), and finally transformed according to the limitations of the local environment (the "actual value").

6.1.1 Specified values

User agents must first assign a specified value to each property based on the following mechanisms (in order of precedence):

  1. If the cascade results in a value, use it.
  2. Otherwise, if the property is inherited and the element is not the root of the document tree, use the computed value of the parent element.
  3. Otherwise use the property's initial value. The initial value of each property is indicated in the property's definition.

6.1.2 Computed values

Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document.

The computed value of URIs that the UA cannot resolve to absolute URIs is the specified value.

The computed value of a property is determined as specified by the Computed Value line in the definition of the property. See the section on inheritance for the definition of computed values when the specified value is 'inherit'.

The computed value exists even when the property does not apply, as defined by the 'Applies To' line. However, some properties may define the computed value of a property for an element to depend on whether the property applies to that element.

6.1.3 Used values

Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value.

6.1.4 Actual values

A used value is in principle the value used for rendering, but a user agent may not be able to make use of the value in a given environment. For example, a user agent may only be able to render borders with integer pixel widths and may therefore have to approximate the computed width, or the user agent may be forced to use only black and white shades instead of full color. The actual value is the used value after any approximations have been applied.

6.2 Inheritance

Some values are inherited by the children of an element in the document tree, as described above. Each property defines whether it is inherited or not.

Suppose there is an H1 element with an emphasizing element (EM) inside:

<H1>The headline <EM>is</EM> important!</H1>

If no color has been assigned to the EM element, the emphasized "is" will inherit the color of the parent element, so if H1 has the color blue, the EM element will likewise be in blue.

When inheritance occurs, elements inherit computed values. The computed value from the parent element becomes both the specified value and the computed value on the child.

Example(s):

For example, given the following style sheet:

body { font-size: 10pt }
h1 { font-size: 130% }

and this document fragment:

<BODY>
  <H1>A <EM>large</EM> heading</H1>
</BODY>

the 'font-size' property for the H1 element will have the computed value '13pt' (130% times 10pt, the parent's value). Since the computed value of 'font-size' is inherited, the EM element will have the computed value '13pt' as well. If the user agent does not have the 13pt font available, the actual value of 'font-size' for both H1 and EM might be, for example, '12pt'.

Note that inheritance follows the document tree and is not intercepted by anonymous boxes.

6.2.1 The 'inherit' value

Each property may also have a cascaded value of 'inherit', which means that, for a given element, the property takes the same specified value as the property for the element's parent. The 'inherit' value can be used to enforce inheritance of values, and it can also be used on properties that are not normally inherited.

If the 'inherit' value is set on the root element, the property is assigned its initial value.

Example(s):

In the example below, the 'color' and 'background' properties are set on the BODY element. On all other elements, the 'color' value will be inherited and the background will be transparent. If these rules are part of the user's style sheet, black text on a white background will be enforced throughout the document.

body {
  color: black !important; 
  background: white !important;
}

* { 
  color: inherit !important; 
  background: transparent !important;
}

6.3 The @import rule

The '@import' rule allows users to import style rules from other style sheets. In CSS 2.1, any @import rules must precede all other rules (except the @charset rule, if present). See the section on parsing for when user agents must ignore @import rules. The '@import' keyword must be followed by the URI of the style sheet to include. A string is also allowed; it will be interpreted as if it had url(...) around it.

Example(s):

The following lines are equivalent in meaning and illustrate both '@import' syntaxes (one with "url()" and one with a bare string):

@import "mystyle.css";
@import url("mystyle.css");

So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media types after the URI.

Example(s):

The following rules illustrate how @import rules can be made media-dependent:

@import url("fineprint.css") print;
@import url("bluish.css") projection, tv;

In the absence of any media types, the import is unconditional. Specifying 'all' for the medium has the same effect. The import only takes effect if the target medium matches the media list.

A target medium matches a media list if one of the items in the media list is the target medium or 'all'.

Note that Media Queries [MEDIAQ] extends the syntax of media lists and the definition of matching.

When the same style sheet is imported or linked to a document in multiple places, user agents must process (or act as though they do) each link as though the link were to a separate style sheet.

6.4 The cascade

Style sheets may have three different origins: author, user, and user agent.

Style sheets from these three origins will overlap in scope, and they interact according to the cascade.

The CSS cascade assigns a weight to each style rule. When several rules apply, the one with the greatest weight takes precedence.

By default, rules in author style sheets have more weight than rules in user style sheets. Precedence is reversed, however, for "!important" rules. All user and author rules have more weight than rules in the UA's default style sheet.

6.4.1 Cascading order

To find the value for an element/property combination, user agents must apply the following sorting order:

  1. Find all declarations that apply to the element and property in question, for the target media type. Declarations apply if the associated selector matches the element in question and the target medium matches the media list on all @media rules containing the declaration and on all links on the path through which the style sheet was reached.
  2. Sort according to importance (normal or important) and origin (author, user, or user agent). In ascending order of precedence:
    1. user agent declarations
    2. user normal declarations
    3. author normal declarations
    4. author important declarations
    5. user important declarations
  3. Sort rules with the same importance and origin by specificity of selector: more specific selectors will override more general ones. Pseudo-elements and pseudo-classes are counted as normal elements and classes, respectively.
  4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter specified wins. Declarations in imported style sheets are considered to be before any declarations in the style sheet itself.

Apart from the "!important" setting on individual declarations, this strategy gives author's style sheets higher weight than those of the reader. User agents must give the user the ability to turn off the influence of specific author style sheets, e.g., through a pull-down menu. Conformance to UAAG 1.0 checkpoint 4.14 satisfies this condition [UAAG10].

6.4.2 !important rules

CSS attempts to create a balance of power between author and user style sheets. By default, rules in an author's style sheet override those in a user's style sheet (see cascade rule 3).

However, for balance, an "!important" declaration (the delimiter token "!" and keyword "important" follow the declaration) takes precedence over a normal declaration. Both author and user style sheets may contain "!important" declarations, and user "!important" rules override author "!important" rules. This CSS feature improves accessibility of documents by giving users with special requirements (large fonts, color combinations, etc.) control over presentation.

Declaring a shorthand property (e.g., 'background') to be "!important" is equivalent to declaring all of its sub-properties to be "!important".

Example(s):

The first rule in the user's style sheet in the following example contains an "!important" declaration, which overrides the corresponding declaration in the author's style sheet. The second declaration will also win due to being marked "!important". However, the third rule in the user's style sheet is not "!important" and will therefore lose to the second rule in the author's style sheet (which happens to set style on a shorthand property). Also, the third author rule will lose to the second author rule since the second rule is "!important". This shows that "!important" declarations have a function also within author style sheets.

/* From the user's style sheet */
p { text-indent: 1em ! important }
p { font-style: italic ! important }
p { font-size: 18pt }

/* From the author's style sheet */
p { text-indent: 1.5em !important }
p { font: normal 12pt sans-serif !important }
p { font-size: 24pt }

6.4.3 Calculating a selector's specificity

A selector's specificity is calculated as follows:

The specificity is based only on the form of the selector. In particular, a selector of the form "[id=p33]" is counted as an attribute selector (a=0, b=0, c=1, d=0), even if the id attribute is defined as an "ID" in the source document's DTD.

Concatenating the four numbers a-b-c-d (in a number system with a large base) gives the specificity.

Example(s):

Some examples:

 *             {}  /* a=0 b=0 c=0 d=0 -> specificity = 0,0,0,0 */
 li            {}  /* a=0 b=0 c=0 d=1 -> specificity = 0,0,0,1 */
 li:first-line {}  /* a=0 b=0 c=0 d=2 -> specificity = 0,0,0,2 */
 ul li         {}  /* a=0 b=0 c=0 d=2 -> specificity = 0,0,0,2 */
 ul ol+li      {}  /* a=0 b=0 c=0 d=3 -> specificity = 0,0,0,3 */
 h1 + *[rel=up]{}  /* a=0 b=0 c=1 d=1 -> specificity = 0,0,1,1 */
 ul ol li.red  {}  /* a=0 b=0 c=1 d=3 -> specificity = 0,0,1,3 */
 li.red.level  {}  /* a=0 b=0 c=2 d=1 -> specificity = 0,0,2,1 */
 #x34y         {}  /* a=0 b=1 c=0 d=0 -> specificity = 0,1,0,0 */
 style=""          /* a=1 b=0 c=0 d=0 -> specificity = 1,0,0,0 */
<HEAD>
<STYLE type="text/css">
  #x97z { color: red }
</STYLE>
</HEAD>
<BODY>
<P ID=x97z style="color: green">
</BODY>

In the above example, the color of the P element would be green. The declaration in the "style" attribute will override the one in the STYLE element because of cascading rule 3, since it has a higher specificity.

6.4.4 Precedence of non-CSS presentational hints

The UA may choose to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules. In a transition phase, this policy will make it easier for stylistic attributes to coexist with style sheets.

For HTML, any attribute that is not in the following list should be considered presentational: abbr, accept-charset, accept, accesskey, action, alt, archive, axis, charset, checked, cite, class, classid, code, codebase, codetype, colspan, coords, data, datetime, declare, defer, dir, disabled, enctype, for, headers, href, hreflang, http-equiv, id, ismap, label, lang, language, longdesc, maxlength, media, method, multiple, name, nohref, object, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onload, onload, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreset, onselect, onsubmit, onunload, onunload, profile, prompt, readonly, rel, rev, rowspan, scheme, scope, selected, shape, span, src, standby, start, style, summary, title, type (except on LI, OL and UL elements), usemap, value, valuetype, version.

For other languages, all document language-based styling must be translated to the corresponding CSS and either enter the cascade at the user agent level or, as with HTML presentational hints, be treated as author level rules with a specificity of zero placed at the start of the author style sheet.

Example(s):

The following user style sheet would override the font weight of 'b' elements in all documents, and the color of 'font' elements with color attributes in XML documents. It would not affect the color of any 'font' elements with color attributes in HTML documents:

b { font-weight: normal; }
font[color] { color: orange; }

The following, however, would override the color of font elements in all documents:

font[color] { color: orange ! important; }
为什么很多人不去庐山 什么样的脚好看 颈椎病看什么科 为什么午睡起来会头疼 闷骚是什么意思
贵州有什么好吃的 血酮体高代表什么 左眼皮一直跳是什么预兆 人活一辈子到底为了什么 做b超前需要注意什么
姓毛的男孩取什么名字好 仓鼠和老鼠有什么区别 睑缘炎用什么药 早日康复送什么花 吃什么排湿气最好最快
绷不住了是什么意思 什么首什么胸 贞操是什么 勃艮第红是什么颜色 gr是什么元素
消化道出血吃什么药hcv8jop5ns5r.cn 大器晚成什么意思hcv9jop0ns3r.cn 上环后需要注意什么hcv9jop3ns9r.cn 九知道指的是什么hcv9jop4ns0r.cn 有胆结石的人不能吃什么东西jasonfriends.com
喝酒前吃什么药wuhaiwuya.com 小青柑属于什么茶hcv9jop5ns5r.cn 大地色眼影是什么颜色hcv9jop5ns4r.cn 湿疹擦什么药膏好hcv8jop8ns5r.cn 什么是c位hlguo.com
自由行是什么意思inbungee.com 为什么不能空腹吃香蕉zhiyanzhang.com 咖啡渣子有什么用途hcv7jop5ns3r.cn av是什么意思hcv9jop5ns9r.cn 咋啦是什么意思hcv8jop3ns2r.cn
慢悠悠的近义词是什么hcv9jop1ns0r.cn 什么地响hcv9jop3ns7r.cn 受精卵着床的时候会有什么症状hcv9jop5ns3r.cn 裙带菜是什么youbangsi.com 鲁米那又叫什么hcv7jop5ns2r.cn
百度