如何将图像放在引导程序中的图像上; [英] how to put image over image in bootstrap;
本文介绍了如何将图像放在引导程序中的图像上;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一幅图像放在另一幅图像上.
I need to put a image over another image.
这是我的代码:
<!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>
它来了:
我的实际需要是在图像上加上加号,就像这样:
推荐答案
好吧,您可能需要使用"position: absolute"
定位第二张图片,然后通过设置将其居中对齐到另一张图片上
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%);
别忘了容器必须具有position: relative
才能包含"fixed"
图像.
Don't forget that the container needs to have position: relative
to contain the "fixed"
image.
这篇关于如何将图像放在引导程序中的图像上;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文