只在身体上启用滚动条,并在CSS HTML上禁用其他Div [英] Only Enable Scrollbar on Body And Disable on Other Div with CSS HTML
问题描述
这个代码在任何地方都禁用所有的滚动条:
有没有一种方法只在主体上启用滚动条并禁用其他div?$ b
:: - webkit-scrollbar {
display:none;
}
如何只在身体上启用?
EDITED
更改溢出不是我想要的。假设我想要创建移动友好视图编辑器,它能够在div内容中上下滚动,但滚动条应该隐藏。滚动条在正文中是必需的,因为我将不得不从我的桌面Web浏览器编辑视图。
在这种情况下更改溢出不会有帮助。
这两个CSS属性可以用来隐藏滚动条:
#parent {
height:100%;
宽度:100%;
overflow:hidden;
}
#child {
width:100%;
身高:100%;
overflow-y:scroll;
}
jsfiddle: http://jsfiddle.net/5GCsJ/954/
Is there a way to only enable scrollbar on the body only and disable on other divs?
This code disables all scrollbar in everywhere:
::-webkit-scrollbar {
display:none;
}
How to enable only on the body?
EDITED
Changing overflow is not the one I want. Let's say I want to create mobile friendly view editor, which able to scroll up and down inside the div content but the scrollbar should be hidden. The scrollbar in the body is necessary because I will have to edit the view from my desktop web browser.
Changing overflow will not help in this case.
These two CSS properties can be used to hide the scrollbars:
#parent{
height: 100%;
width: 100%;
overflow: hidden;
}
#child{
width: 100%;
height: 100%;
overflow-y: scroll;
}
jsfiddle: http://jsfiddle.net/5GCsJ/954/
这篇关于只在身体上启用滚动条,并在CSS HTML上禁用其他Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!