Html 从div中删除滚动条
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17750430/
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
Remove scroll bar from div
提问by Brian
Created a navigation bar and looks good in firefox then behold, in chrome and ie theres a scroll bar. How can I set the navigation so theres no scroll bar?
创建了一个导航栏,在 Firefox 中看起来不错,然后看,在 chrome 中,即有一个滚动条。如何设置导航以便没有滚动条?
header {
width: 800px;
margin-left: auto;
margin-right: auto;
padding-top: -7px;
margin-top: -8px;
}
.nav {
width: 600px;
line-height: 0px;
margin-left: auto;
margin-right: auto;
}
.nav div {
display: block;
float: left;
width: 20%;
padding: 0px;
margin: 0px;
.nav img a {
padding-right: 10px;
}
<header>
<div id="wrapper">
<div class="nav">
<div>
<a href="index.html"><img width="103px" border="0" height="24" src="nav-01_over.gif"></a>
</div>
<div>
<a href="company.html"><img src="nav-02.gif" width="103px" border="0" height="24"></a>
</div>
<div>
<a href="products.html"><img src="nav-03.gif" width="103px" border="0" height="24"></a>
</div>
<div>
<a href="solutions.html"><img src="nav-04.gif" width="103px" border="0" height="24"></a>
</div>
<div>
<a href="investors.html"><img src="nav-05.gif" width="103px" border="0" height="24"></a>
</div>
</div>
</header>
回答by PaulProgrammer
In your css, use overflow:hidden
:
在你的 css 中,使用overflow:hidden
:
.nav div {
display:block;
float:left;
width:20%;
padding:0px;
margin:0px;
overflow:hidden
}
Also, your .nav div
is missing a close brace
另外,您.nav div
缺少一个大括号
回答by melancia
By changing the CSS and adding:
通过更改 CSS 并添加:
overflow: hidden;
回答by Arda
Add the CSS overflow-y:hidden
to anything scrolling. It will hide the vertical scrollbar. If it's horizontal, use overflow-x: hidden
.
将 CSS 添加overflow-y:hidden
到任何滚动的内容中。它将隐藏垂直滚动条。如果它是水平的,请使用overflow-x: hidden
.
回答by Abhay Sisodia
$(function() {
$( "#draggable" ).draggable();//drag out of window
$( "#draggable" ).draggable({ containment: "window"});
});