小编sta*_*roy的帖子

为什么滚动条向左突出也不出现?

我创建了这段代码。这会向右溢出,导致出现滚动条:

.content {
  position: absolute;
  height: 100px;
  width: 100px;
  right: -50px;
  top: 50px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="content">
  CONTENT
</div>
Run Code Online (Sandbox Code Playgroud)


但是,这段向左延伸的代码并没有生成滚动条。我从 W3C 规范中解释说,这会在两个方向上创建滚动条。

overflow-x 属性指定对水平方向溢出的处理(即从框的左右两侧溢出),overflow-y 属性指定对垂直方向溢出的处理(即从框的左右溢出)盒子的顶部和底部)。

https://www.w3.org/TR/css-overflow-3/

.content {
  position: absolute;
  height: 100px;
  width: 100px;
  left: -50px;
  top: 50px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="content">
  CONTENT
</div>
Run Code Online (Sandbox Code Playgroud)

W3C 规范是否解释了为什么向左投影时不生成滚动条?

html css language-lawyer

5
推荐指数
1
解决办法
115
查看次数

标签 统计

css ×1

html ×1

language-lawyer ×1