首页 > 编程知识 正文

html overflow属性,css滚动条不显示怎么设置

时间:2023-05-04 00:09:50 阅读:171491 作者:572

只是一个工作正常的测试。

#parent{

height: 100%;

width: 100%;

overflow: hidden;

}

#child{

width: 100%;

height: 100%;

overflow-y: scroll;

padding-right: 17px; /* Increase/decrease this value for cross-browser compatibility */

}

JavaScript:

因为,不同浏览器的滚动条宽度不同,最好用JavaScript处理它。如果你做Element.offsetWidth – Element.clientWidth,将会显示确切的滚动条宽度。

要么

使用位置:绝对,

#parent{

height: 100%;

width: 100%;

overflow: hidden;

position: relative;

}

#child{

position: absolute;

top: 0;

bottom: 0;

left: 0;

right: -17px; /* Increase/Decrease this value for cross-browser compatibility */

overflow-y: scroll;

}

信息:

基于这个答案,我创建了一个simple scroll plugin.我希望这将帮助某人。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。