centering image in div
Posted
by
Harsh Reddy
on Stack Overflow
See other posts from Stack Overflow
or by Harsh Reddy
Published on 2013-06-28T10:12:20Z
Indexed on
2013/07/01
4:21 UTC
Read the original article
Hit count: 125
I have a square <div>
(70px
x 70px
) which will contain an image of a variable dimensions(Square, landscape or potrait). I want this image to be symmetrically centered inside the <div>
. how do I get it..?
<div class="img-polaroid" style="width: 70px; height: 70px; background-color: black; text-align:center;">
<image src='.base_url("images/store/images/".$image->image).' />
</div>
The actual size of the image can be greater than 70px
x 70px
. But it should fit symmetrically in the center.
I also have to make it cross-browser compatible.. Help Appreciated...
© Stack Overflow or respective owner