0

Here is my code. Please help to make it centering middle and also, all images size is not the same

CSS:

body {
   margin: 0px;
}

.wrapper {
   text-align:center;
   width: 100%;
   height: 100%;
   position: relative;
   z-index: 21
}

.wrapper img {
   display: table-cell;
   vertical-align: middle; 
}

HTML:

<div class="wrapper">
  <img src="http://static.desktopnexus.com/thumbnails/196734-bigthumbnail.jpg" />
</div>
Vukašin Manojlović
  • 2,645
  • 2
  • 21
  • 26
user1866612
  • 165
  • 1
  • 7
  • I'm almost positive that most elements that have `inline-block` as their default display properties (images, form fields) cannot be set to `table-cell`. – cimmanon Dec 29 '12 at 15:35

1 Answers1

0

You just need to set the margin on the image.

.wrapper img {
    margin: auto;
}

This method can be used in any objects but make sure the parent has a width or height set.

Licson
  • 2,231
  • 18
  • 26