首页 > 解决方案 > Bootstrap 4:两个图像叠加

问题描述

我需要一些帮助。我应该这样做,就像在屏幕截图中一样。我试图把 img (z-index: 5在彩色线 ( z-index: 2) 上。

在此处输入图像描述

我的 jsfiddle 演示

标签: bootstrap-4

解决方案


我试图通过查看图片来编写代码。这是我所做的。看看代码。我想我做了你想做的事..但即使没有,也请告诉我..

#image {
	background: url('http://www.lefrancais.eu/files/2013/05/signature-contrat.jpg')
		no-repeat center/cover;
	margin: 0;
	padding: 0;
	width: 100%;
	height: 95vh;
	position: relative;
	overflow: hidden;
	z-index: -1;
}
#image-2 {
	margin-top: -100px;
	margin-bottom: -3.6%;
}
#image-2 img {
	height: 100px;
	width: 170px;
}
footer {
	width: 100%;
	height: 5vh;
	background-color: #333;
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
    crossorigin="anonymous">
  <link rel="stylesheet" type="text/css" media="screen" href="style.css" />
  <script src="script.js"></script>
</head>

<body>
  <div class="container">
    <div class="container-fluid">
      <div id="image">
        <h2 class="display-6 text-center mt-5 text-light">Découvrez tous nos
          programmes près de chez vous</h2>

      </div>
      <div id="image-2">
        <img src="https://image.freepik.com/icones-gratuites/logo-de-pomme_318-40184.jpg" alt="">
      </div>
    </div>
  </div>

  <footer>
  </footer>
</body>

</html>


推荐阅读