简体   繁体   English

CSS:overflow-x:滚动不起作用

[英]CSS: overflow-x: scroll not working

I'm missing something really simple here. 我在这里遗漏了一些非常简单的东西。 The scrollbar is appearing, but the knob that allows you to scroll is not showing up? 滚动条出现了,但是滚动的旋钮没有显示?

<div class="name">
   <div class="name-scroll"> test
</div>

.name {
  background: #EFEFEF;
  box-shadow: 1px 1px 10px #999;
  margin: auto;
  text-align: center;
  position: relative;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  padding-top: 5px;
  overflow: hidden;
  height: 100px;
}
.name-scroll {
  background-color: lime;
  overflow-x: scroll;
  overflow-y: hidden;
  height: 80px;
  width: 10000px;

} }

Here's the fiddle: http://jsfiddle.net/CnpL8/1/ 这是小提琴: http//jsfiddle.net/CnpL8/1/

Thanks! 谢谢!

the overflow property should be set on the container, not on the containee. 溢出属性应设置在容器上,而不是容器上。

.name {
    background: #EFEFEF;
    box-shadow: 1px 1px 10px #999;
    margin: auto;
    text-align: center;
    position: relative;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    padding-top: 5px;
    overflow: hidden;
    height: 100px;
    width: 300px;
    overflow-x: scroll;
    overflow-y: hidden;
}
.name-scroll {
    background-color: lime;
    height: 80px;
    width: 10000px;
}

see: http://jsfiddle.net/CnpL8/2/ 见: http//jsfiddle.net/CnpL8/2/

You put the scrool on the wrong div: 你把scrool放在错误的div上:

.name {
    overflow-x: scroll;
}

http://jsfiddle.net/CnpL8/3/ http://jsfiddle.net/CnpL8/3/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM