HTML Element Style How to - Cut image height








Question

We would like to know how to cut image height.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
li {<!--from   ww  w  .  ja v  a 2 s  . com-->
  float: left;
  height: 100px;
  overflow: hidden;
  margin: 10px;
}

li:hover {
  height: auto;
}
</style>
</head>
<body>
  <ul>
    <li><img src="http://lorempixel.com/100/100/"></li>
    <li><img src="http://lorempixel.com/100/200/"></li>
    <li><img src="http://lorempixel.com/100/300/"></li>
    <li><img src="http://lorempixel.com/100/400/"></li>
  </ul>
</body>
</html>

The code above is rendered as follows: