Code :
<div class="img-contain"> <img alt="hello" src="dd.jpg" class="center-img"> </div>
First Solution and best Solution :
div.img-contain
{
height: 500px;
width: 100%;
}
.center-img
{
margin: auto;
display: block;
height: 100px;
width: 100px;
/*** if position is absolute ****/
left: 0;
right: 0;
position: absolute;
}
Second Solution is :
div.img-contain
{
height: 500px;
width: 100%;
text-align: center;
}
.center-img
{
display: block;
/*** if position is absolute ****/
left: 0;
right: 0;
position: absolute;
}
1 comments :
thanks
Post a Comment