从div中删除滚动条

时间:2013-07-19 15:54:16

标签: html css

创建了一个导航栏,在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>

4 个答案:

答案 0 :(得分:9)

在您的CSS中,使用overflow:hidden

.nav div {
    display:block;
    float:left;
    width:20%;
    padding:0px;
    margin:0px;
    overflow:hidden
}

此外,您的.nav div缺少一个大括号

答案 1 :(得分:3)

通过更改CSS并添加:

overflow: hidden;

答案 2 :(得分:2)

将CSS overflow-y:hidden添加到滚动的任何内容中。它将隐藏垂直滚动条。如果它是水平的,请使用overflow-x: hidden

答案 3 :(得分:-1)

 $(function() {
    $( "#draggable" ).draggable();//drag out of window
    $( "#draggable" ).draggable({ containment: "window"});
 });