css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

  <div class="site">
  <h1>Scrollable Modal Demo</h1>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Non nisi, ratione consequatur eum aliquam tenetur quod magni exercitationem blanditiis enim, recusandae soluta voluptates consectetur quae aut, quos dicta eaque quis.
      One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me?" he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. 
  <button id="js-open" class="btn btn-primary">Open Modal</button>
    <div class="bg"></div>
      A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot, which was created for the bliss of souls like mine. I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now. When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream; and, as I lie close to the earth, a thousand unknown plants are noticed by me: when I hear the buzz of the little world among the stalks, and grow familiar with the countless indescribable forms of the insects and flies, then I feel the presence of the Almighty, who formed us in his own image, and the breath.
  <div class="my-modal">
    <div class="my-modal-content">
      <img width="100%" class="img-rounded" src="http://1design.jp/wp-content/uploads/2016/01/eyecatch-3.jpg" alt="" />
      <h3>Hi! I'm Pooty!</h3>
      <button id="js-close" class="btn btn-primary">Close</button>
              $modal-width: 700px;
$modal-height: 580px;

body.no-scroll {
    overflow: hidden;

.site {
    max-width: 800px;
    margin: 3em auto;

.bg {
    background-size: cover;
    background: url("http://1design.jp/wp-content/uploads/2016/01/eyecatch-1.jpg") center center;
    height: 500px;
    width: 200%;
    margin-left: -50%;
    margin-top: 3em;
    margin-bottom: 3em;

.my-modal {
    position: fixed;
    background-color: rgba(255, 255, 255, .8);
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    overflow: auto;

.my-modal-content {
    position: absolute;
    width: $modal-width;
    height: $modal-height;
    text-align: center;
    padding: 2em;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.26), 0 26px 52px rgba(0, 0, 0, 0.26);

@media only screen and (min-width: $modal-width) {
    .my-modal-content {
        left: 50%;
        margin-left: -#{$modal-width / 2};

@media only screen and (min-height: $modal-height) {
    .my-modal-content {
        top: 50%;
        margin-top: -#{$modal-height / 2};
              var $body = $('body');

$('#js-close').on('click',()=> {

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................