overflow-x 和 overflow-y
這兩個屬性的工作方式與 overflow
屬性類似,並且接受相同的值。overflow-x
引數僅適用於 x 或左右軸。overflow-y
在 y 軸或從上到下軸上工作。
HTML
<div id="div-x">
If this div is too small to display its contents,
the content to the left and right will be clipped.
</div>
<div id="div-y">
If this div is too small to display its contents,
the content to the top and bottom will be clipped.
</div>
CSS
div {
width: 200px;
height: 200px;
}
#div-x {
overflow-x: hidden;
}
#div-y {
overflow-y: hidden;
}