非替换元素绝对定位

Recoding
  • 417

最近在看这个规范https://www.w3.org/TR/CSS2/vi...
其中一段

If all three of 'left', 'width', and 'right' are 'auto': First set any 'auto' values for 'margin-left' and 'margin-right' to 0. Then, if the 'direction' property of the element establishing the static-position containing block is 'ltr' set 'left' to the static position and apply rule number three below; otherwise, set 'right' to the static position and apply rule number one below.

rule number three是

'width' and 'right' are 'auto' and 'left' is not 'auto', then the width is shrink-to-fit . Then solve for 'right'

这前后文是不是矛盾,第一段说了If all three of 'left', 'width', and 'right' are 'auto',而规则3却说'left' is not 'auto'

还有第二个问题,First set any 'auto' values for 'margin-left' and 'margin-right' to 0意思是如果margin设置为auto,那么则会被视为0

回复
阅读 1.1k
1 个回答
✓ 已被采纳

set 'left' to the static position and apply rule number three below

眼睛!

第二个问题是对的

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏