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

              
                <div class="modal">
  <div class="overlay"></div>
  <div class="modal__contents modal--transition">
    <div class="modal-header">
      <h3> <span> Whoops!<span> <b>It looks like this offer has expired<br> or else been used by another customer.</b></h3>
    </div>
    <div class="modal-body">
      <div class="content-left">
         <p>
            Continue with sending this card <br>
            for $1.98 plus shipping.
         </p>
         <a href="#"class="btn-green-flat">Send Card</a>
       </div>
      <div class="content-right">
         <p> To learn how to send this card<br> for free contact <span class="sponsor-name">Jordan Adler</span> <br> through the link below.</p>
         <a href="#"class="btn-green-flat">Contact</a>
      </div>
    </div>
  </div>
</div>

<div class="dib tc">
  <h1>Responsive Modal</h1>
  <p>Uses different transitions based on screen size.</p>
  <a class="btn-green-flat-trigger" href="#">Show Modal</a>
</div>


              
            
!

CSS

              
                * {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
}

body {
  font-family: "Helvetica Neue";
  color: #666;
  padding: 40px;
}

a {
  color: #D4341A;
  text-decoration: none;
}

.tc {
  text-align: center;
}

.dib {
  display: block;
}

.credit {
  position: fixed;
  bottom: 10px;
  width: 100%;
  left: 0;
}
.btn-green-flat-trigger{
  border: 1px solid #47ba6b;
  background: transparent;
  font-size: 20px;
  color: #47ba6b;
  font-weight: 200;
  padding: 15px 30px;
  display: inline-block;
  margin: 0 auto;
  margin-top: 40px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  -o-border-radius: 4px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-green-flat {
  border: 1px solid #47BA6B;
  background: rgba(0, 0, 0, 0);
  font-size: 20px;
  color: #47BA6B;
  font-weight: 200;
  padding: 10px 28px;
  text-align: center;
  width: 175px;
  display: block;
  margin: 0 auto;
  margin-top: 20px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  -o-border-radius: 4px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
}
.overlay {
	background: rgba(255, 255, 255, 0.77);
	position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.modal {
  visibility: hidden;
}

.modal__contents {
  background: #FFF;
  -webkit-box-shadow:0 0 8px 2px rgba(182, 182, 182, 0.75);
  -moz-box-shadow:0 0 8px 2px rgba(182,182,182, 0.75);
  -o-box-shadow:0 0 8px 2px rgba(182,182,182,0.75);
  box-shadow:0 0 8px 2px rgba(182,182,182,0.75);
  width: 50%;
  position: absolute;
  left: 38%;
  margin-left: -14%;
  top: 15%;
  min-height: 450px;
}
.modal-header{
  border-bottom: 1px solid #ccc;
}
.modal-header h3{
  color: #34495E;
  text-align: center;
  font-weight: bold;
  font-size: 22px;
}
.modal-header span{
  font-weight: 200;
}
.modal-body{
  width: 100%;
}
.modal-body p{
  color: #34495E;
  font-size: 16px;
  line-height: 23px;
	text-align: center;
}
.modal-body .content-left {
  height: 225px;
  width: 50%;
  position: relative;
  top: 55px;
  float: left;
  border-right: 1px solid #CCC;
}

.modal-body .content-right{
  height: 225px;
  width: 50%;
  position: relative;
  top: 55px;
  float: left;
}
.content-right .sponsor-name{
  font-weight: bold;
  color: #000;
}
.modal__contents h1 {
  margin: 0;
  padding: 0;
  line-height: 32rem;
  text-align: center;
  display: block;
}

.modal__close {
  position: absolute;
  right: 2rem;
  top: 2rem;
  text-decoration: none;
  display: none;
}

.modal--show {
  visibility: visible;
}

.modal--transition {
	-webkit-transform: scale(0.7);
	-moz-transform: scale(0.7);
	-ms-transform: scale(0.7);
	transform: scale(0.7);
	opacity: 0;
	-webkit-transition: all 0.3s;
	-moz-transition: all 0.3s;
	transition: all 0.3s;
}

.modal--show .modal--transition {
	-webkit-transform: scale(1);
	-moz-transform: scale(1);
	-ms-transform: scale(1);
	transform: scale(1);
	opacity: 1;
}

@media (max-width: 1139px){
	.modal p{
    text-align: center;
  }
  .modal-body .content-left{
  	width: 80%;
    display:block;
    float: none;
    margin: 0 auto;
    border-right: none;
    border-bottom: 1px solid #ccc;
}
  .modal-body .content-right{
    width: 80%;
    display: block;
    margin: 40px auto;
    float: none;
    border-right: none;
  }
}

@media (max-width : 991px) {
	
  .modal__contents {
  	top: 0;
  	left: 0;
    bottom: 0;
    width: 100%;
    margin: 0;
  }
  .modal-header h3{
    font-size: 18px;
  }
  .modal__close {
    display: block;
  }
  
  .modal--transition {
    -webkit-transform: translateX(-0) translateY(150%);
    -moz-transform: translateX(-0) translateY(150%);
    -ms-transform: translateX(-0) translateY(150%);
    transform: translateX(-0) translateY(150%);
  }
  
}
              
            
!

JS

              
                var modal = $('.modal');

$( ".btn-green-flat-trigger" ).on( "click", function() {
  $( modal ).toggleClass('modal--show');
});

$( ".overlay" ).on( "click", function() {
  $( modal ).toggleClass('modal--show');
});

$( ".modal__close" ).on( "click", function() {
  $( modal ).toggleClass('modal--show');
});  

              
            
!
999px

Console