HTML Element Style How to - Remove margin from image








Question

We would like to know how to remove margin from image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--from   w w  w  .j  a  v a 2  s  . c  o  m-->
  margin: 0;
  display: block
}
</style>
</head>
<body>
  <div align="center">
    <img src="http://www.java2s.com/style/download.png">
    <img src="http://www.java2s.com/style/download.png">
    <img src="http://www.java2s.com/style/download.png">
    <img src="http://www.java2s.com/style/download.png">
  </div>
</body>
</html>

The code above is rendered as follows: