html - 如何在 Bootstrap 中将图像放在图像上;

标签 html css twitter-bootstrap

我需要将一张图片放在另一张图片上。

这是我的代码:

<!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>

它是这样的:

enter image description here

我的实际需要是在图像上加号,如下所示:

enter image description here

最佳答案

试试这个

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>

关于html - 如何在 Bootstrap 中将图像放在图像上;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35197899/

相关文章:

html - 如何在 Chrome 中将数字输入重置为默认行为

javascript - 如何将页眉区域粘贴在页面顶部?

css - Firefox 不呈现 FontAwesome

javascript - 用 HTML 制作一个简单的终端

asp.net - 在 asp.net 核心 Web 应用程序 + Angular 项目中更新 Bootstrap

html - 内部 div 使用基于自身的外部 div 的 100% 高度

html - 除了内容之外调整标题的大小

html - 有没有办法让Vue组件的模板仅包含属性文本?

html - css - 停靠一个面板并滚动另一面板

css - 如何在: and after: and box-sizing:border-box work in ie7之前制作