Html CSS - 只有水平溢出?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1336600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 00:42:54  来源:igfitidea点击:

CSS - Only Horizontal Overflow?

htmlxhtmloverflowcss

提问by Richard Knop

Is it possible to achieve only horizontal overflow in CSS 2.1?

是否可以在 CSS 2.1 中仅实现水平溢出?

overflow: auto;

Will cause a block element to have both horizontal and vertical scrollbars. I want a block element (let's say <div>) which will display only horizontal scrollbars. How do I do that?

将导致块元素同时具有水平和垂直滚动条。我想要一个<div>只显示水平滚动条的块元素(比方说)。我怎么做?

回答by C???

Try overflow-x: auto;

尝试 overflow-x: auto;

It even works in IE6!

它甚至适用于 IE6!

回答by Bikram Shrestha

I tried overflow-x: hidden;and that worked for me.

我试过了overflow-x: hidden;,这对我有用。