【问题标题】:CSS Positioning with nested fixed property具有嵌套固定属性的 CSS 定位
【发布时间】:2019-01-24 05:52:16
【问题描述】:

.a{
  position:fixed;
  top:0px;
  left:0px;
  height:100%;
  width:100%;
  background:yellow;
  z-index:1000000

}

.b{
  position:fixed;
  color:green;
  background:pink;
  left:60px;

}

.c{
  position:relative;
 
}

.d{
  position:static;
 
}
<div class="a">

  <div class="b">
  c is overlapping d is not
  </div>
  <span class="c">
overlaping sibling
  </span>
  <span class="d">
  i    am    not a overlapping     sibling
</span>
</div>

Click here for JSFiddle 在上面的小提琴中,我有一个 html,请通过它并解释我为什么 &lt;span class="c"&gt;&lt;div class = "b"&gt; 重叠,为什么&lt;span class="d"&gt;&lt;div class = "b"&gt; 不重叠 这两个跨度有什么区别,为什么表现不同?

【问题讨论】:

标签: html css


【解决方案1】:

因为&lt;span class="d"&gt;position:static。如果您想了解更多信息,可以参考下面的链接。谢谢

https://www.w3schools.com/cssref/pr_class_position.asp

【讨论】:

  • 我同意,但我想知道为什么一个跨度落后而一个跨度元素在顶部
猜你喜欢
  • 2011-02-19
  • 1970-01-01
  • 2013-08-25
  • 2018-09-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-20
  • 2011-05-10
相关资源
最近更新 更多