I have added an image with class "img-circle". I need to put another small image at the center of this image which is center for all devices.
Can any one tell me how to fix this issue.
<!-- begin image within image :: background size cover does not work in IE make sure you don't exceed the width of the actual image -->
<div class="circle-wrapper">
<span class="force-ratio"></span>
<div class="img-container align-center">
<div class="center-block-valign"></div>
<img class="img-circle" src="http://placehold.it/250x250/000000&text=image+2" alt="">
</div><!--img-container align-center-->
</div><!--circle-wrapper-->
<!-- end image within image -->
.circle-wrapper * {
box-sizing:content-box;
-moz-box-sizing:content-box;
-webkit-box-sizing: content-box
}
.circle-wrapper {
position: relative;
width: 100%;
box-sizing:content-box;
-moz-box-sizing:content-box;
-webkit-box-sizing: content-box
background-image:url(http://placehold.it/400x400/ff6600/FFFFFF&text=image+1);
background-position:50% 50%;
background-size:cover;
background-repeat:none;
border-radius:50%;
max-width:400px;
max-height:400px;
}
.force-ratio {
padding-top: 100%;
display:block;
}
.img-container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.align-center {
text-align:center;
font: 0/0 a;
}
.center-block-valign {
display: inline-block;
vertical-align: middle;
height: 100%;
}
.circle-wrapper .img-circle {
vertical-align: middle;
display: inline-block;
max-width:50%;
padding:25%;
}
Much of this was found by googling "center responsive image inside another image" from this http://jsbin.com/aXiReCub/1/edit. Then, because BS3 uses a global border-box sizing, adjustments need to be made among other things.
Add following css code to your css file
.img-circle{position:relative}
anothor-image-selector:{position:absolute;margin:auto;top:0;left:0;bottom:0;right:0}
for pro and cons of this method just visit following article :
http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
box-sizing:contant-box;
use this code. I hope help you.