我真正想要实现的是将背景图像放到特定的高度,就像我有一个包含两个div的部分我给了该部分一个背景图像,这是
background-image: linear-gradient(-207deg, #0EC573, #0093FF);
现在我要实现的是背景图像覆盖了整个第二个div和第一个div的某些部分
完整的代码
<section class="company py-4" >
<div class="container">
<div class="row">
<div class="col-12">
<div class="mt-5 px-3">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="4000">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="{!! asset('images/Company/02.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item ">
<div class="justify-content-center align-items-center">
<img class="img-fluid" src="{!! asset('images/Company/01.jpg') !!}">
</div>
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/03.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/04.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
</div>
<!-- <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a> -->
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row justify-content-center align-items-center">
<div class="col-12 ">
<h1 class="text-left heading">Company</h1>
<p class="text-left description"> ALL THE DESCRIPTION</p>
</div>
</div>
</div>
</section>
使用它(参见JSFiddle:https://jsfiddle.net/Lfxja1e5/7/):
background-size: 100% 70%;
background-repeat: no-repeat;
**如果你想在底层使用它:
background-position: bottom;
.company{
background-image:linear-gradient(-207deg,#0EC573, #0093FF);
background-size: 100% 70%;
background-repeat: no-repeat;
background-position: bottom;
}
<section class="company py-4" >
<div class="container d1">
<div class="row">
<div class="col-12">
<div class="mt-5 px-3">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="4000">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="{!! asset('images/Company/02.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item ">
<div class="justify-content-center align-items-center">
<img class="img-fluid" src="{!! asset('images/Company/01.jpg') !!}">
</div>
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/03.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/04.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
</div>
<!-- <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a> -->
</div>
</div>
</div>
</div>
</div>
<div class="container d2">
<div class="row justify-content-center align-items-center">
<div class="col-12 ">
<h1 class="text-left heading">Company</h1>
<p class="text-left description"> ALL THE DESCRIPTION</p>
</div>
</div>
</div>
</section>