How to Align A image Center of Div (top,bottom,left,right) using CSS ??

How to Align A image Center of Div (top,bottom,left,right) using CSS ??

Stack of Codes

Example:

<div class="image">
 <img alt="" src="Path"  />
</div>

CSS::
 
.image {
    width: 100%;
    height: 230px;
    position: relative;
}

.image img {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto;
    left: 0;
    right: 0;

}

Leave a Reply

Your email address will not be published. Required fields are marked *