HTML Element Style How to - Wrap Div tight two images side by side








Question

We would like to know how to wrap Div tight two images side by side.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.social {<!--  w  ww  .ja v  a 2  s.c  om-->
  background: #EEE;
  line-height: 0;
  margin-bottom: 10px;
}
</style>
</head>
<body>
  <div class="social">
    <img src="http://www.java2s.com/style/download.png">
  </div>
  <div class="social">
    <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">
    <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: