Utilizing bootstrap 3, I am looking to incorporate two shadows within a container. The first shadow will be positioned at the top of the container, followed by the second shadow at the bottom using absolute positioning.
CSS:
.section-st1 {
padding: 0px;
border-top:1px solid #000;
border-bottom:1px solid #000;
}
.section-st1 .shadowtop {
position: absolute;
margin-top:-1px;
background-color:#e1e1e1;
}
.section-st1 .shadowbot {
margin-bottom:0;
position:absolute;
background-color:#e1e1e1;
}
HTML :
<section class="section section-st1 section-align-center">
<div class="container">
<div class="shadowtop">
<img alt="shadow1" src="img/shadow-top.png"></img>
</div>
<div class="row">
<div class="col-lg-12">
<h2>welcome to</h2>
<p>Vestibulum nunc erat, venenatis tristique nisi sit amet, volutpat accumsan lorem. Sed quis tortor magna. Maecenas hendrerit feugiat pulvinar. Aenean condimentum quam eu ultricies cursus. Nulla facilisi. In hac habitasse platea dictumst. Ut nec tellus neque. Sed non dui eget arcu elementum facilisis.</p>
</div>
</div>
<div class="shadowbot">
<img alt="shadow2" src="img/shadow-bot.png"></img>
</div>
</div>
</section>
I have applied position: absolute
for the first shadow and it displays correctly. However, the second shadow is not visible in the container. How can I resolve this issue?
DEMO:
body {
margin-top: 10px;
}
.section-st1 {
padding: 0px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
.section-st1 .shadowtop {
position: absolute;
margin-top: -1px;
background-color: #e1e1e1;
}
.section-st1 .shadowbot {
margin-bottom: 0;
position: absolute;
background-color: #e1e1e1;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<section class="section section-st1 section-align-center">
<div class="container">
<div class="shadowtop">
<img alt="shadow1" src="https://loremflickr.com/500/3?random=1" />
</div>
<div class="row">
<div class="col-lg-12">
<h2>welcome to</h2>
<p>Vestibulum nunc erat, venenatis tristique nisi sit amet, volutpat accumsan lorem. Sed quis tortor magna. Maecenas hendrerit feugiat pulvinar. Aenean condimentum quam eu ultricies cursus. Nulla facilisi. In hac habitasse platea dictumst. Ut nec
tellus neque. Sed non dui eget arcu elementum facilisis.</p>
</div>
</div>
<div class="shadowbot">
<img alt="shadow2" src="https://loremflickr.com/500/3?random=2" />
</div>
</div>
</section>