Pen Settings

HTML

CSS

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

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

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.

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

              
                <body>

  <h1>Pure CSS pop-up (modal) 
    with &lt;details&gt; and &lt;summary&gt;</h1>
  <p>The native HTML elements that open and close without any scripts can be used for FAQs, but also for modals!</p>
  
  <details>
    <summary class="button">Click to open me</summary>
			
    <div>
      <h2>Everything after summary appears within a modal</h2>
      <p>The HTML Details Element creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label can be provided using the summary element.</p>
    </div>
	</details>

</body>
              
            
!

CSS

              
                body { 
  padding: 2em 4em;
  font-family: Roboto, sans-serif;
}

.button {
  width: 10em;
  text-align: center;
  font-weight: bold;
  padding: 1em 2em;
  background: DEEPPINK;
  border-radius: 3em;
  color: white;
  cursor: pointer;
}

details > div {
  width: 20em;
  border: 2px solid black;
  padding: 1em 2em;
  position: fixed;
  width: 360px;
  height: 240px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  background: white;
  z-index: 3;
  box-shadow: 10px 10px 10px DIMGRAY;
}

details[open] summary::after { 
  content: "×"; 
  font-size: 28pt;  
  position: fixed; 
  right: calc(50vw - 360px / 2 - 2em); 
  top:  calc(50vh - 240px / 2 - 2em);
  padding: 5pt 10pt;
  z-index: 9;
}

details[open] summary::before {
  content: '';
  display: block;
  width: 100vw;
  height: 100vh;
  background: black;
  position: fixed;
  top: 0;
  left: 0;
  opacity: 0.5;
  z-index: 1;
}
              
            
!

JS

              
                
              
            
!
999px

Console