'How to make scrollable pop up box?

https://codepen.io/anon/pen/dWaWor

When I click on the button "Creation Process" I cannot scroll in the lightbox.

The lightbox has a fixed position because when I used absolute the background messes up. The lightbox is a white background.

<section id="lightbox">
   <i id="x" class="fa fa-times-circle"aria-hidden="true"></i>
   <p class="large">hi</p>
</section>

>

#lightbox {
  height:100%;
  width:100%;
  display: none;
  position: fixed;
  top:0;
  left:0;
  background: #fff;
  z-index:1;
}

>

 var btn_process = document.getElementById('creation-process');
 var lightbox = document.getElementById('lightbox');
 var x = document.getElementById('x');

 btn_process.onclick = function () {
    lightbox.style.display = 'block';
};

x.onclick = function () {
    lightbox.style.display = 'none';
}


Solution 1:[1]

try this code. Is this what you were after?

#lightbox {
    height: 80%;
    width: 80%;
    display: none;
    position: fixed;
    top: 6%;
    left: 10%;
    background: #fff;
    z-index: 1;
    overflow:auto;
}

I have added overflow auto so on smaller screens the lightbox will be a scroll.

Let me know if this is what you were after.

Update:

To have a scroll on only the #lightbox then you can add overflow auto to your CSS.

#lightbox {
    height:100%;
    width:100%;
    display: none;
    position: fixed;
    top: 0%;
    left: 0%;
    background: #fff;
    z-index: 1;
    overflow:auto;
}

Solution 2:[2]

If you need only vertical scroll, use overflow-y: scroll !important;

#lightbox {
height:100%;
width:100%;
display: none;
position: fixed;
top: 0%;
left: 0%;
background: #fff;
z-index: 1;
overflow-y: scroll !important;

}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Bruno Azevedo