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

              
                <h1>Floating action button (FAB)</h1>
<div class="sponsor">
  <a href="https://chroma.dev" target="_blank">👉 Chroma: Epic browser color tools</a>
</div>
<div class="popout">
  <div class="btn">
    <svg width="32" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
      <path style="stroke: #4650F1;" stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" />
    </svg>
  </div>
  <div class="panel">
    <div class="panel-header">
      Literature adds to reality, it does not simply describe it. It enriches the necessary competencies that daily life requires and provides; and in this respect, it irrigates the deserts that our lives have already become.
    </div>
    <div class="panel-body">
      C.S. Lewis
    </div>
  </div>
</div>
              
            
!

CSS

              
                body {
  font: 400 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  background-color: #4650F1;
  letter-spacing: 0.01rem;
  padding: 5rem;
  -webkit-font-smoothing: antialiased;
  -moz-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1 {
  color: #fff;
  font-weight: 300;
  margin: 0;
  line-height: 1;
}
.popout {
  position: absolute;
  bottom: 3rem;
  right: 3rem;
}
.popout .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none;
  user-select: none;
  cursor: pointer;
  width: 60px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 32px;
  z-index: 999;
  background: #eee;
  color: #00a3dd;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  transition: 0.2s opacity ease-in-out;
}
.popout .btn.active {
  visibility: hidden;
  opacity: 0;
}
.popout .btn:after {
  display: block;
  position: absolute;
  top: 0;
  content: "";
  border-radius: 50%;
  width: 60px;
  height: 60px;
  background: white;
  z-index: -2;
  transition: transform 0.2s, opacity 0.2s;
}
.popout .btn:active:after {
  -webkit-transform: scale(1.3);
  -moz-transform: scale(1.3);
  -ms-transform: scale(1.3);
  transform: scale(1.3);
  opacity: 0;
}
.popout .panel {
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
  position: absolute;
  bottom: 0;
  right: 0;
  width: 440px;
  text-align: left;
  overflow: hidden;
  visibility: hidden;
  transform: scale(0);
  transform-origin: 100% 100%;
  transition: all 0.2s;
  opacity: 0;
}
.popout .panel.active {
  height: auto;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: transform 0.2s, visibility 0s 0s, opacity 0.2s;
}
.popout .panel-header {
  padding: 2rem;
  font-size: 1.5rem;
  background-color: #F4E0E0;
  font-weight: 300;
  color: black;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}
.popout .panel-body {
  padding: 1.5rem 2rem;
  background-color: white;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  font-size: 13px;
}

.sponsor {
  a {
    display: block;
    text-decoration: none;
    color: white;
    margin-top: 30px;
  }
}

              
            
!

JS

              
                $(".popout .btn").click(function () {
  $(this).toggleClass("active");
  $(this).closest(".popout").find(".panel").toggleClass("active");
});
$(document).click(function () {
  $(".popout .panel").removeClass("active");
  $(".popout .btn").removeClass("active");
});
$(".popout .panel").click(function (event) {
  event.stopPropagation();
});
$(".popout .btn").click(function (event) {
  event.stopPropagation();
});

              
            
!
999px

Console