如何在div标签中隐藏水平滚动条

时间:2010-07-13 09:00:36

标签: html scrollbar hidden

我的div大小为x = 540px y = 600px

即使文字大于x尺寸,我也希望隐藏水平滚动条。

如何隐藏水平滚动条?

4 个答案:

答案 0 :(得分:19)

使用overflow-x

<div class="MyDivClass"></div>

CSS:

.MyDivClass {
    height: 600px;
    width: 540px;
    overflow-x: hidden;
}

如果您还想隐藏垂直使用overflow-y: hidden;或仅隐藏overflow: hidden;

答案 1 :(得分:1)

.MyDivClass {
    height: 600px;
    width: 540px;
    overflow-x: hidden;
}

答案 2 :(得分:1)

在正文标记中使用overflow-x: hidden隐藏整个HTML网页上的水平滚动条

body {
    background: none repeat scroll 0 0 #757575;
    font: 100%/1.4 Verdana,Arial,Helvetica,sans-serif;
    margin: 0;
    padding: 0;
    height: 600px;
    width: 540px;
    overflow-x: hidden;
}

答案 3 :(得分:0)

你也可以使用下面的代码

很好地控制它
.div{
    width: 540;
    height: 600px;
    overflow: scroll;
    overflow-x: hidden;
}
相关问题