Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

overflow-y: scroll not working, showing style but cannot be scrolled?

Tags:

html

css

my code is simple like this:

.list {
    margin: auto;
    height: 285px;
    width: 300px;
    overflow-y: scroll;
}
<div class="list">
  <ul>
    <li>hello world</li>
    <li>hello jupiter</li>
    <li>hello mars</li>
  </ul>
</div>

it shows style of a scroll on the side but lacking that scroll you use to move up and down?

like image 897
gpbaculio Avatar asked Sep 11 '25 11:09

gpbaculio


1 Answers

You can get it by reducing height like following

.list {
  margin: auto;
  height: 70px;  /* Reduse height */
  width: 300px;
  overflow-y: scroll;
}
<div class="list">
  <ul>
    <li> hello world </li>
    <li> hello jupiter </li>
    <li> hello mars </li>
  </ul>
</div>
like image 78
LKG Avatar answered Sep 13 '25 01:09

LKG