Issue
I need to center an image in a middle of a div.
<div class="main">
<img...>
</div>
In the example below the image is centered, but not in the middle.
https://jsfiddle.net/web_garaux/tng7db0k/
Solution
Simple and easy method to do this,
.test {
background-color: orange;
width: 700px;
height: 700px;
display:flex;
align-items:center;
justify-content:center;
}
<div class="test">
<img src="http://via.placeholder.com/350x150">
</div>
Answered By - codesayan Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.