CSS Layout How to - Scroll for overflow-x by mousewheel








Question

We would like to know how to scroll for overflow-x by mousewheel.

Answer


<!DOCTYPE html>
<html>
<head>Overflow scroll along X
<style type='text/css'>
#two {<!--from   w  ww .java2s  .c o  m-->
  border: 5px solid black;
  height: 200px;
  width: 20000px;
}

#one {
  border: 1px solid red;
  height: 200px;
  width: 200px;
  overflow-y: hidden;
  overflow-x: scroll;
}
</style>
</head>
<body>
  <div id="one">
    <div id="two"></div>
  </div>
</body>
</html>

The code above is rendered as follows: