Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>overscroll-behavior demo</h1>
<p>Use the CSS property `overscroll-behavior: contain` to stop element from scroll-chaining.</p>
<p>Blog post: <a href="https://getcssscan.com/blog/prevent-page-scrolling-while-scrolling-div-element?ref=demo" target="_blank">How to prevent the page from scrolling when scrolling an element</a></p>

<div class="demo">
  <p>
    With `overscroll-behavior: auto` (default).<br><br>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet ante porta, sollicitudin diam in, mattis nisi. Integer lobortis non felis ut fringilla. Sed commodo neque sed elit fermentum accumsan. Maecenas mollis, ex sit amet volutpat interdum, urna enim feugiat quam, et euismod libero eros non massa. Proin ut nisi condimentum, semper eros in, volutpat velit. Maecenas ac semper ipsum. Curabitur placerat odio quis urna varius, at luctus augue luctus. Duis dignissim pharetra mauris. Vivamus tincidunt diam vel velit dictum, lobortis finibus neque porta. Maecenas efficitur interdum velit maximus iaculis. In libero turpis, tristique in lacus quis, tempor maximus odio. Praesent arcu orci, porttitor lacinia rhoncus vel, bibendum et ex. Nunc in dui ut sapien dapibus ullamcorper. Curabitur hendrerit magna justo, at ullamcorper lectus maximus ac.
    <br><br>
    Keep scrolling...
  </p>

  <p class="contained-overscroll">
    With `overscroll-behavior: contain`.<br><br>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet ante porta, sollicitudin diam in, mattis nisi. Integer lobortis non felis ut fringilla. Sed commodo neque sed elit fermentum accumsan. Maecenas mollis, ex sit amet volutpat interdum, urna enim feugiat quam, et euismod libero eros non massa. Proin ut nisi condimentum, semper eros in, volutpat velit. Maecenas ac semper ipsum. Curabitur placerat odio quis urna varius, at luctus augue luctus. Duis dignissim pharetra mauris. Vivamus tincidunt diam vel velit dictum, lobortis finibus neque porta. Maecenas efficitur interdum velit maximus iaculis. In libero turpis, tristique in lacus quis, tempor maximus odio. Praesent arcu orci, porttitor lacinia rhoncus vel, bibendum et ex. Nunc in dui ut sapien dapibus ullamcorper. Curabitur hendrerit magna justo, at ullamcorper lectus maximus ac.
    <br><br>
    Keep scrolling... ;)
  </p>
</div>

<a href="https://getcssscan.com?ref=overscroll-demo" class="cssscan-link" rel="noopener" target="_blank">
                <div class="cssscan">
                  <p class="title">Have you seen CSS Scan?</p>
                  <p class="desc">Check the CSS of any element you hover over, instantly.</p>
                  <p class="learn-more">Learn more →</p>
                  <img src="https://toastlog.com/img/logos/cssscan.svg" alt="CSS Scan logo">
                </div>
              </a>
              
            
!

CSS

              
                p.contained-overscroll {
  overscroll-behavior: contain;
}

div.demo {
  margin-top: 2em;
}

div.demo > p {
  width: 50%;
  max-width: 300px;
  max-height: 100px;
  overflow-y: auto;
  margin-right: 2em;
  border: 2px solid red;
  border-radius: 2px;
  position: relative;
  padding: 10px;
}

div.demo > p:last-child {
  margin-right: 0;
}

div.demo > p.contained-overscroll {
  border-color: green;
}

body {
  padding: 0.7% 2.5%;
  font-family: sans-serif;
  min-height: 200vh;
}

div.demo {
  display: flex;
}


a.cssscan-link,
.cssscan-link a {
    color: #333;
}

a.cssscan-link {
    text-decoration: none;
}

.cssscan {
  padding: 60px;
  background: #c2fbd7;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, .1) 0 1px 2px 0;
  cursor: pointer;
  margin: 100vh 0 1em;
  font-size: 19px;
}

.cssscan p.title {
  font-size: 28px;
  margin-bottom: 0;
  margin-top: 0;
}

.cssscan img {
  position: absolute;
  top: 10%;
  right: 0;
  width: 200px;
  height: 200px;
  transform: rotate(-7deg);
  transition: all .3s;
}

.cssscan:hover img {
  top: 6%;
  right: 0;
  transform: scale(1.1) rotate(-7deg);
}

.cssscan:hover p.learn-more {
  text-decoration: underline;
}

.cssscan p.title {
  margin-bottom: 20px;
  font-weight: bold;
}

.cssscan p.desc {
  opacity: .8;
  color: #333;
  margin-top: 10px;
  margin-bottom: 1.3em;
}

p.learn-more {
  margin: 0;
}

@media screen and (min-width: 0px) and (max-width: 1010px) {
.cssscan {
  padding: 30px;
  margin-left: 0;
  margin-right: 0;
  }

  .cssscan img {
    top: initial;
    bottom: -15%;
    right: 0;
    width: 100px;
    height: 100px;
  }

  .cssscan:hover img {
    top: initial;
    bottom: -12%;
    right: 0;
    transform: scale(1.1) rotate(-7deg);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console