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="box">
  <h2>iOS 7</h2>
  <p>When you bring up the control center in iOS 7, the background is shown with a translucant effect.</p>
  <img src="https://s.cdpn.io/79/ios7.controlcenter.jpg">
<div class="box">
  <p>Is there a way to do it on the web?</p>
  <div class="iphone">
    <div id="homescreen" class="homescreen">
      <div class="animation"></div>
    <div class="control-center">
      <div class="control-center-background"></div>
      <div class="control-center-content">
        <h3>Control Center</h3>
  <p>It kinda works if the layer underneath would be just a known static background (like in the example above). You could doublicate it and just add a CSS filter. But since it could be anything, you kinda have to take "screenshots" of it. And if there is also animation underneath (like with the Gyro and in the above example the red ball), even more tricky. In Firefox there is the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/element">element property</a> that could work. But that's still experimental.</p>
  <p>Any other way to "screen record" other HTML elements and use it as a background?</p>
  <p><strong>Update I: </strong><a href="https://twitter.com/SaraSoueidan/status/350479973288648705">Some</a> <a href="https://twitter.com/cgiffard/status/350480271872770048">suggested</a> using CSS shaders.</p>
  <p><strong>Update II: </strong>Here a <a href="http://iamvdo.me/conf/2012/kiwiparty/#/33">demo</a> that uses -moz-element to "screen record" the background (Test with Firefox, click anywhere to bring up the popup). It's getting close. It just needs better browser adoption and better performance.. kinda lags behind when dragging around.</p>
.iphone {
  position: relative;
  width: 244px;
  height: 433px;
  overflow: hidden;

.homescreen {
  width: inherit;
  height: inherit;
  background: url(https://s.cdpn.io/79/ios7-homescreen.jpg);
  background-size: 100%;

.animation {
  margin: 0 auto;
  width: 50px;
  height: 50px;
  background: red;
  border-radius: 25px;
  animation: animate 1s alternate infinite;

@keyframes animate {
  100% { transform: translateY(200px); }

.control-center {
  position: absolute;
  background: hsla(0,0%,100%,.8);
  top: 112px;
  left: 0;
  right: 0;
  bottom: 0;

.control-center:hover .control-center-background {
  background: transparent;

.control-center-background {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url(https://s.cdpn.io/79/ios7-homescreen.jpg);
  background-size: 100%;
  background-position: center bottom;
  -webkit-filter: contrast(30%) brightness(160%) blur(12px);

.control-center-content {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  text-align: center;

h3 {
  line-height: 3em;
  font-weight: normal;
  border-bottom: 1px solid black;

.box {
  display: inline-block;
  padding: 30px;
  width: 45%;
  min-width: 244px;
  vertical-align: top;

* {
  box-sizing: border-box;
🕑 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.