开发者

how to hide horizontal scrollbar in div tag

开发者 https://www.devze.com 2023-01-06 19:00 出处:网络
I have a div with size x=540px y=600px I 开发者_开发知识库want to hide horizontal scroll bareven if text is bigger than x size.

I have a div with size x=540px y=600px

I 开发者_开发知识库want to hide horizontal scroll bar even if text is bigger than x size.

How can i hide just the horizontal scroll bar?


use overflow-x

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

CSS:

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

if you also want to hide the vertical use overflow-y: hidden; or for both just overflow: hidden;


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


Use overflow-x: hidden in body tag to hide horizontal scroll bar on whole HTML page

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;
}


You can also nicely control that using below code

.div{
    width: 540;
    height: 600px;
    overflow: scroll;
    overflow-x: hidden;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消