HTML Element Style How to - Enlarge an image horizontally








Question

We would like to know how to enlarge an image horizontally.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#container-table {<!--from   w  w w .java2  s .  c o m-->
  width: 100%;
}

#rightBanner {
  display: block;
  background-image:url('http://www.java2s.com/style/download.png');
  background-size: 100% 100%;
  width: 50%;
  height: 95px;
}
</style>
</head>
<body>
  <table id="container-table">
    <tr>
      <td id="rightBanner"></td>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: