Bootstrap 4:两个图像叠加

时间:2018-11-08 13:18:12

标签: bootstrap-4

我需要一些帮助。我应该这样做,如屏幕截图所示。我试图将img(z-index: 5放在彩色线(z-index: 2)上。

enter image description here

My jsfiddle Demo

1 个答案:

答案 0 :(得分:0)

我试图通过看图片进行编码。这就是我所做的。看一下代码。我想我做了您想尝试的事情。.即使没有,也请告诉我。.

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