position:fixed将触发display:block? [英] the position:fixed will trigger the display:block?

查看:84
本文介绍了position:fixed将触发display:block?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在chrome或Firefox上运行时进行了测试,但在
上除外position:fixed将触发display:block?
这是测试html: http://sking7.github.com/fix.html
该代码将发出两次警报,第一次是显示,第二次是document.compatMode
这为什么?
w3c曾说过这个话?

i tested ,when running on chrome or firefox, except on ie,
the position:fixed will trigger the display:block?
this the test html :http://sking7.github.com/fix.html
the code will alert two times,the first is display ,the second is document.compatMode
this why?
the w3c has said this ?

推荐答案

好吧,我发现了

9.7显示",位置"和浮动"之间的关系

影响框生成和布局的三个属性-显示",位置"和浮动"-相互作用如下:

9.7 Relationships between 'display', 'position', and 'float'

The three properties that affect box generation and layout — 'display', 'position', and 'float' — interact as follows:

  1. 如果显示"的值为无",则位置"和浮动"不适用.在这种情况下,该元素不会生成任何框.
  2. 否则,如果"position"的值为"absolute"或"fixed",则表示框处于绝对位置,"float"的计算值为"none",并根据下表设置显示.框的位置将由顶部",右侧",底部"和左侧"属性以及框的包含块确定.
  3. 否则,如果"float"的值不是"none",则该框将浮动,并根据下表设置"display".
  4. 否则,如果该元素是根元素,则根据下表设置"display",除了在CSS 2.1中未定义,"list-item"的指定值是否变为"block"的计算值或列表项".
  5. 否则,其余的"display"属性值将按照指定的方式应用.


Specified value                                     Computed value

inline-table                                        table

*inline*, table-row-group, table-column, 
table-column-group, table-header-group, 
table-footer-group, table-row, table-cell, 
table-caption, inline-block                         *block*

others                                              same as specified

这篇关于position:fixed将触发display:block?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆