Page Widget How to - Center text and image








Question

We would like to know how to center text and image.

Answer


<!--from w ww  . j a v  a2s .co  m-->
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#Outer1 {
  display: table-cell;
  height: 500px;
  width: 500px;
  border: 1px solid red;
  vertical-align: middle;
  text-align: center;
}
</style>
</head>
<body>
  <div id="Outer1" class="elementStatus">
    <div class="image">
      <!-- THIS IS THE IMAGE -->
      <img src="http://www.java2s.com/style/download.png" />
    </div>
    <div class="text">Statuts Text</div>
  </div>
</body>
</html>

The code above is rendered as follows: