Medium Feed


Wednesday, October 7, 2015

Horizontal center align the Image inside the Div

If we have just text inside DIV , we can make that content center aligned just by giving "text-align:center". But in the case of having image inside the DIV and we wanted to make the image to be center aligned in DIV then "text-align:center" will NOT help.

Quick/ Easy fix is :

<div class="container>
<img  src="somthing.jpg" class="img">

.container { text-align:center;}
.img { display:inline; margin:0; padding:0}

No comments:

Post a Comment