overflow-y scroll not working for ul nested in div

Viewed 9352

There must be something special required to get overflow-y: scroll to work, and I'm unable to find it... Any ideas?

https://jsfiddle.net/tmnx2z0u/

HTML:

<div>
  <ul>
    <li>
      One
    </li>
    <li>
      One
    </li>
    <li>
      One
    </li>
    <li>
      One
    </li>
    <li>
      One
    </li>
    <li>
      One
    </li>
    <li>
      One
    </li>
  </ul>
</div>

CSS:

div {
  background-color: #FFFFEE;
  width: 200px;
  height: 100px;
  overflow-y: hidden;
}

ul {
  overflow-y:scroll;
}
4 Answers

I had this problem and placed height: 100% but it didn't resolve but by specifying the hardcoded value resolved the problem height: 200px.

The Other way to maintain the value height: 100% is by placing height property all the parent elements.

Related