html - CSS overlay that takes 100% of parent element height -
i need element in snippet tinted darker. this, have overlay element black partial transparency. cover red element in it's entirety. problem is, can't overlay 100% height. why won't work, , how can work without specifying exact heights?
.overlay-shell { position: relative; top: 0; left: 0; } .overlay { background-color: rgba(0, 0, 0, 0.5); top: 0; left: 0; height: 60px; /* how take 100% of height? */ width: 100%; position: absolute; } ul.alarms { list-style: none; margin: 0 30px; } ul.alarms li.alarm { background-size: 100%; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #c53635), color-stop(50%, #9d2b2a), color-stop(51%, #952928), color-stop(100%, #9d2b2a)); background-image: -moz-linear-gradient(#c53635 0%, #9d2b2a 50%, #952928 51%, #9d2b2a 100%); background-image: -webkit-linear-gradient(#c53635 0%, #9d2b2a 50%, #952928 51%, #9d2b2a 100%); background-image: linear-gradient(#c53635 0%, #9d2b2a 50%, #952928 51%, #9d2b2a 100%); } ul.alarms .content { } ul.alarms li .right-sidebar { float: right; max-width: 180px; } ul.alarms .bottom-bar { clear: both; } .response-btn { display: inline-block; width: 20%; text-align: center; margin: 0px; padding: 0px; }
<html> <ul class="alarms"> <li class="alarm" id="alert_87590"> <div class="overlay-shell"> <div class="overlay"></div> </div> <div class="content"> <div class="primary"> <a href="/senior/1828"><h1 class="provisioned-service-name">hannah montana</h1> </a> </div> </div> <div class="right-sidebar"> <p> <a class="address" href="/senior/1828">unit 128</a> </p> </div> <div class="bottom-bar"> <div class="response-btn"> <span>yes</span> </div><div class="response-btn"> <span>ok</span> </div><div class="response-btn"> <span>thank you</span> </div><div class="response-btn"> <span>custom</span> </div><div class="response-btn"> <span>roger</span> </div> </div> </li> </ul> </html>
set height of .overlay 100vh equal the viewport height:
overlay { background-color: rgba(0, 0, 0, 0.5); top: 0; left: 0; height: 100vh; width: 100%; position: absolute; }
still black overlay whole height of page
Comments
Post a Comment