I have created a pop-up div for my contact form in my website.
this is the current HTML:
<div class="contact_form">
<div class="form_container">
</div>
</div>
and this is my CSS:
.contact_form{
display : none;
width : 100%;
height : 100%;
background : rgba(0, 0, 0, 0.7);;
position : absolute;
top : 0;
left : 0;
}
.contact_form .form_container{
background-image: url('images/popup-post-it_2.png');
background-size: 100%;
background-repeat: no-repeat;
display: block;
width: 33.4em;
z-index: 1001;
position: fixed;
top: 22%;
left: 34%;
padding-left: 10px;
margin: auto;
height: 33em;
}
2 problems:
- I can scroll the page - and I shouldn't be able to do that.
- when I scroll - the ".form_container" scrolls with me.
I know how to disable it using javascript, but I find it wrong from past experiments, makes things messy.
Is there a more elegant way to do this, maybe using CSS ?