Diarmuid Shelly
Diarmuid Shelly

Reputation: 115

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/

Thanks!

Upvotes: 1

Views: 480

Answers (2)

Damien Black
Damien Black

Reputation: 5647

You put the scrool on the wrong div:

.name {
    overflow-x: scroll;
}

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

Upvotes: 0

BiAiB
BiAiB

Reputation: 14171

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/

Upvotes: 3

Related Questions