CSS Property Value How to - text-align: center; align image








Question

We would like to know how to text-align: center; align image.

Answer


<!--  w  w  w.j  a  v a  2 s  . c  o  m-->
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#footer {
  position: absolute;
  bottom: 0;
  margin: 0 auto;
  padding: 0;
  heigh: 112px;
  width: 100%;
  z-index: 97;
}

#sponsors {
  text-align: center;
  margin: 0 auto 6px;
  padding: 0px 0px 0px 0px;
}

#sponsors img {
  width: 16%;
}

#sponsors img:hover {
  opacity: 0.6;
}
</style>
</head>
<body>
  <div id="footer">
    <div id="sponsors">
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>
      <a href="" target="_blank"><img src="http://www.java2s.com/style/download.png"></a>

    </div>
  </div>
</body>
</html>

The code above is rendered as follows: