css - Make overlay fixed-like, but the content container scrollable -
my code creates overlay blocks page black, , there's form inside of inner container. when it's active, blocks page, overlay absolute , stretches window width , height 100%, when scroll down, overlay not stretching.
when make fixed, stays in 1 place, content of not scrollable.
how make fixed, scrollable?
.quote_overlay, .email_overlay { display: none; position: absolute; width: 100%; height: 100%; z-index: 1000; top: 0; left: 0; background-image: url(img/overlay_bg.png); } .quote_container, .email_container { width: calc(100% - 20px); max-width: 600px; background-color: #ccc; position: relative; top: 50%; left: 50%; -ms-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); padding: 10px; border-radius: 6px; border: 0; }
you need separate overlay element , email container. this.
your html:
<div class="email_container"></div> <div class="email_overlay"></div>
then on css:
.email_overlay { position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-image: url(img/overlay_bg.png); z-index: 1; } .email_container { width: calc(100% - 20px); max-width: 600px; background-color: #ccc; position: absolute; top: 50%; left: 50%; -ms-transform: translate(-50%, -50%); -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); padding: 10px; border-radius: 6px; border: 0; z-index: 2;
}
Comments
Post a Comment