I need to put a image over another image.
This is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class = "row text-center" style="">
<div class="col-xs-6 text-center" style="background-color:none; margin-top:10px;">
<img src="1.jpg" width="250" height="250">
<img src="plus.png" width="50px" height="50px">
</div>
</div>
</body>
</html>
It came like:
My Actual need is Plus symbol over the image, like this:
Try this
CSS:
.product-holder {
position: relative;
display: block;
}
.plus-image {
left: 50%;
top: 50%;
position: absolute;
margin-top: -25px;
margin-left: -25px;
}
HTML
<div class = "row text-center" style="">
<div class="col-xs-6 text-center" style="background-color:none; margin-top:10px;">
<div class='product-holder'>
<img src="1.jpg" width="250" height="250" class='product-image'>
<img src="plus.png" width="50px" height="50px" class='plus-image'>
</div>
</div>
</div>
Well you probably need to position the second image with a "position: absolute"
and then center align it over the other image by setting
margin-top: 50%;
margin-left: 50%;
transform: translate(-50%,-50%);
Don't forget that the container needs to have position: relative
to contain the "fixed"
image.
give position:absolute on your icon...
and move it on image using css
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With