Skip to content Skip to sidebar Skip to footer

Centering Image Horizontally And Vertically

Possible Duplicate: How to make an image center (vertically & horizontally) inside a bigger div I am trying to make an image gallery on my website, but I cannot center the i

Solution 1:

One way to do it is a table cell display and vertical align: middle;

Fiddle


Solution 2:

margin:auto; add autommatic margin and center the image have a try, but I need more code , could you post it?


Solution 3:

margin:auto;

it will automatically center your div by adding equal margin to the left and right of your div block element


Solution 4:


Solution 5:

Put your image inside div and center it like this: Fiddle here

 div{
 width:300px;
 height:300px;
 margin:0px auto;
 margin-top:30px; //to pull it down
 }

Post a Comment for "Centering Image Horizontally And Vertically"