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="container">
  <div class="content">
    <h1>Simple Modal Window with only CSS</h1>
    <div class="md-btn-area">
      <!-- Open the first modal window("one") -->
      <a href="#modal-one" class="md-btn">Modal 1</a>
      <!-- Open the second modal window("two") -->
      <a href="#modal-two" class="md-btn">Modal 2</a>
      <!-- Open the second modal window("three") -->
      <a href="#modal-three" class="md-btn">Modal 3</a>
      <img src="https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLa3VscHBocThYUXc" alt="pic" width="500" class="sample-img" />

// Modal window section 
<!-- First modal named "one" -->
<section id="modal-one" class="modal">
  <div class="modal-inner">
    <h2>This is the first modal window!</h2>
    <p>Fusce cursus nec sem ut porttitor. Morbi imperdiet erat magna, et sollicitudin nibh iaculis ac. Donec pulvinar eros in eleifend pulvinar.</p>
  <a href="#" class="close"><span>close</span></a>

<!-- Second modal named "two" -->
<section id="modal-two" class="modal">
  <div class="modal-inner">
    <h2>This is the second modal window!</h2>
    <p>Fusce cursus nec sem ut porttitor. Morbi imperdiet erat magna, et sollicitudin nibh iaculis ac. Donec pulvinar eros in eleifend pulvinar.</p>
  <a href="#" class="close"><span>close</span></a>

<!-- Third modal named "three" -->
<section id="modal-three" class="modal">
  <div class="modal-inner">
    <h2>This is the third modal window!</h2>
    <img src="https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLaW15anJvNl9DMlU" alt="pic" width="400" class="sample-img" />
  <a href="#" class="close"><span>close</span></a>
              @import url(https://fonts.googleapis.com/css?family=Lato:300);
  background-color: #333;
.container {
  color: #ccc;
  text-align: center;
.content {
  margin: 0 auto;
.content a {
.content h1 {
.sample-img {
  border:5px solid rgba(255,255,255,0.2);

/* ****************
 * Open modal button (trigger)
 * *************** */
.md-btn-area {
.md-btn {
  border: 1px solid #7a7a7a;
  padding: 10px;
  border-radius: 3px;
  cursor: pointer;
  background-color: #666;
  text-shadow: 0 -1px 0 #000;
  -webkit-box-shadow: 0 0 0 1px #222;
  box-shadow: 0 0 0 1px #222;
.md-btn:hover {
  background-color: #6e6e6e; 

/* ****************
 * Modal window
 * *************** */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  text-shadow:0 1px 0 #333;
  color: #fff;
  text-align: center;
  font-size: 20px;
  -webkit-transition: opacity .4s linear;
  transition: opacity .4s linear;
  -webkit-transform: translate(0,100%);
  -ms-transform: translate(0,100%);
  transform: translate(0,100%);
/* Modal content */
.modal-inner {
  margin:60px 5% 5%;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-box-shadow: 0 0 15px rgba(0,0,0,0.2);
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
.modal h2 {
  border-bottom:1px solid;

/* ****************
 * Modal close button
 * *************** */
.modal .close {
  position: absolute;
  top: 0;
  left 0;
  background-color: rgba(0,0,0,.74);
.modal .close span {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background-color: rgba(255,255,255,.2);
.modal .close span {
  text-indent: -9999px;
.modal .close span:before,
.modal .close span:after {
  content: "";
  position: absolute;
  top: 4px;
  border: 1px solid #fff;
  height: 30px;
.modal .close span:before {
  left: 19px;
  -webkit-transform: rotate(-45deg);
  -ms-transform: rotate(-45deg);
  transform: rotate(-45deg);
.modal .close span:after {
  right: 19px;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);

/* ****************
 * Append modal(target id)
 * *************** */
#modal-three:target {
  opacity: 1;
  -webkit-transform: translate(0,0);
  -ms-transform: translate(0,0);
  transform: translate(0,0);
🕑 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 ..................