Solution 1 :

We can try exploiting overflow property in CSS. But only works for fixed heights and widths.

.popup{
    overflow: scroll;       //newly added
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    padding: 50px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, .30);
    background: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    visibility: hidden;
    opacity: 0;
    transition: 0.5s;
}

Solution 2 :

Nevermind, I have an answer.
It was just

overflow-y: scroll;
max-height: 100%;

Solution 3 :

In CSS add overflow: scroll; or overflow: auto; to the div with the long text and it should scroll.

Solution 4 :

Add a fixed height and use overflow: auto; to enable scrolling when content is taller than container height.

.popup {
    position: fixed;
    width: 600px;
    height: 200px;
    background: #e0e0e0;
    overflow: auto;
}
<div id="textPopup" class="popup">
        <h2>Header for the text</h2>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>

Problem :

I have made a popup using a fixed div and blurring the background.

.blur#blur.active {
  filter: blur(20px);
  pointer-events: none;
  user-select: none;
}

.popup {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  padding: 50px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, .30);
  background: #fff;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  visibility: hidden;
  opacity: 0;
  transition: 0.5s;
}

.popup.active {
  top: 50%;
  visibility: visible;
  opacity: 1;
  transition: 0.5s;
}
<div id="textPopup" class="popup">
  <a onclick="hideAllForms()" style="cursor: pointer;"><img style="width: 35px; float: right;" src="images/icons/kreuz.png" /></a>
  <h2>Header for the text</h2>
  <p>Long text</p>
</div>

And this HTML

Now one of these popups should contain a long text, so you should be able to scroll down the text in the div container and not scroll down the page.

Thanks!

Comments

Comment posted by Kenny

Now what is your actual problem? You want your fixed div scrollble? Or customized scrollbar?

Comment posted by Kenny

I would prefer

Comment posted by John

Yeah that is probably better.

By