javascript - CSS centered image -
i have 1 question image centering.
i have created demo codepen.io.
in demo can see have used background image centering looks me.
the image normalize looking this: normalize
the question how can use img tag instead of background , change html like:
<div class="centered-image"> <img src="image-url"/> </div>
use display: flex , let img tag have width:100%. demo
.centered-img{ width:540px; height:200px; margin:0px auto; margin-top:50px; display:flex; justify-content:center; align-items:center; overflow:hidden; } .centered-img img{ width: 100%; } <div class="centered-img"> <img src="http://i.imgur.com/bxo4qaz.jpg" /> </div>
Comments
Post a Comment