Html 如何在div中添加滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28275546/
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
how to add scrollbar in div
提问by Klevi
I want to add a scrollbar
to div id="kryesore"
in mainpage,when i try it doesn't work.Can you tell me what can i do and how can i fix it?
我想在主页上添加一个scrollbar
div id="kryesore"
,当我尝试时它不起作用。你能告诉我我能做什么,我该如何解决它?
below 2 screenshot how it look like : l
下面 2 个屏幕截图它的样子:l
回答by Prashant Bhujbal
change the line
换线
<div id="kryesore">
to
到
<div id="kryesore" style="overflow-y: scroll;">
or you can write in your css or style tag in head as
或者你可以在你的 css 或 style 标签中写成
#kryesore
{
overflow-y:scroll;
}
working for me.
为我工作。
回答by Luca Detomi
Use overflow
property to add scrollbar only when necessary:
overflow
仅在必要时使用属性添加滚动条:
#kryesore
{
overflow-y:auto;
}
回答by Pattle
You can use the overflow-y
property by doing
您可以overflow-y
通过执行以下操作来使用该属性
#kryesore
{
overflow-y:scroll;
}
overflow-y
was only support from IE9 onward so if you are using an older version of IE you could just use overflow
overflow-y
仅从 IE9 开始支持,因此如果您使用的是旧版本的 IE,则可以使用 overflow
#kryesore
{
overflow:scroll;
}