HTML Element Style How to - Align an image with space in between in the same line, float left








Question

We would like to know how to align an image with space in between in the same line, float left.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--  w w  w.ja va 2  s .  co  m-->
  float: left;
  padding: 10px;
}
</style>
</head>
<body>
  <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" />
</body>
</html>

The code above is rendered as follows: