I have a main page with some content on it. I then have a modal that pops up which is longer than the screen itself so I have to scroll to see it. What do I need to do to my CSS to make only the modal div
scroll instead of the whole page?
Here is the CSS for the modal
#overlay {
visibility: hidden;
position: absolute;
left: 45%;
width:auto;
border:1px solid #A17E13;
height:auto;
text-align:left;
z-index: 1000;
}
#overlay div {
background-color:#FCFBEC;
}
Here is the HTML :
<html><body>
<div>main page</div>
<div id="overlay">
<div>
<div>
<asp:Label ID="test">Text for modal here</asp:Label>
</div>
</div>
</div>
</body></html>
has the entire page not to be scrollable except of the modal div? if so can you try position:fixed; on the page. the modal has to be outside with position:absolute;
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#overlay {
/*visibility: hidden;*/
position: fixed;
left: 45%;
width:auto;
border:1px solid #A17E13;
height:900px;
text-align:left;
background-color:orange;
}
.scroller {
height:3000px;
width:400px;
background-color:green;
}
</style>
</head>
<body>
<div id="overlay">
this is not moving
</div>
<div>
<div class="scroller">
<asp:Label ID="test">This is moving if big enough</asp:Label>
</div>
</div>
</body>
</html>
Fiddle here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With