cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

              <button type="button" id="popup-trigger">Open Popup</button>

<div id="popup">
  This is the popup
    Click on somewhere outside of this popup to hide it.

  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
  <div class="card"></div>
              *:focus {
  outline: none !important;

body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  padding: 0 calc(50% - 24rem);

button {
  cursor: pointer;
  border: solid 2px;
  background-color: transparent;
  color: #8EA6D0;
  border-radius: .5rem;
  padding: .7rem 1rem;

#popup {
  position: absolute;
  width: 600px;
  height: 200px;
  background-color: rgba(0,0,0,.7);
  color: white;
  padding: 1rem;
  box-sizing: border-box;
  display: none;

#popup.in {
  display: block;

.card {
  width: 100%;
  height: 200px;
  background: #F7CAC9;
  margin: 1rem 0;
              // By default always hide the popup when the user is clicking on somewhere
document.body.onclick = function() {
  removeClass(document.querySelector("#popup"), "in");

// Show the popup
document.querySelector("#popup-trigger").addEventListener("click", function() {
  addClass(document.querySelector("#popup"), "in");

// Define which elements shouldn't behave like default
var els = document.querySelectorAll("#popup-trigger, #popup");

// When clicking on these elements don't hide the popup
for (var i = 0; i < els.length; i++) {
  els[i].addEventListener("click", function(e) {
Loading ..................