HTML Element Style How to - Align group of images vertically








Question

We would like to know how to align group of images vertically.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--   w  ww  .j  a va  2s  .  co m-->
  display: block;
  margin: 0 auto;
}
</style>
</head>
<body>
  <img src="http://www.java2s.com/style/download.png" alt="" width="45" height="26" />
  <img src="http://www.java2s.com/style/download.png" alt="" width="45" height="26" />
  <img src="http://www.java2s.com/style/download.png" alt="" width="45" height="26" />
  <img src="http://www.java2s.com/style/download.png" alt="" width="45" height="26" />
</body>
</html>

The code above is rendered as follows: