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.


CUBE: A "zero-element" CSS-only demo


 * Single element "6 sided" cube with lighting
 * Revolving text ticker
 * Post-process esq interlace/interference effect


$speed: 5s;            // duration of the animation
$size: 25vmin;          // size of the cube
$hs1: -$speed/4;        // precalculate the per-face shading animation offset
$hs2: -$speed/6;        // precalculate the per-face 
$text-width: 9.15em;

@font-face {
  font-family: 'Share Tech Mono';
  font-style: normal;
  font-weight: 400;
  src: local('Share Tech Mono'), local('ShareTechMono-Regular'), url( format('woff2');

html {
  height: 100%;
  perspective: 550px;
  overflow: hidden;
  background: #000;
head {
  position: fixed;
  display: block;
  background: radial-gradient(ellipse farthest-corner, #32444a, #222);
body {
  width: $size;
  height: $size;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -$size/2;
  transform-origin: 50% 50% $size/2;
  animation: $speed spinXY linear infinite, $speed shade linear infinite, 5s scale  ease-in-out infinite alternate;
  transform-style: preserve-3d;

body:before, body:after {
  content: "";
  position: absolute;
  width: inherit;
  height: inherit;
body:before {
  transform: translateX($size/2) translateZ($size/2) rotateY(90deg);
  animation: $speed $hs1 shade linear infinite;

body:after {
  transform: translateY(-$size/2) translateZ($size/2) rotateX(90deg);
  animation: $speed $hs2 shade linear infinite;

html::before {
  font: 5vh / 1.5 "Share Tech Mono";
  position: absolute;
  bottom: 10vh;
  left: 10vh;
  content: 'CUBE             A CSS DEMO       @keithclarkcouk  ';
  color: #fff;
  overflow: hidden;
  animation: 3s 2s text-fade infinite alternate backwards, 18s 2s text steps(3) infinite;
  text-shadow: 0 0 5px #fff;
  width: $text-width - 1em;
  white-space: pre;
  z-index: 2;
html::after {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  bottom: -3px;
  background-image: linear-gradient(
    rgba(0,0,0,.2) 0px,
    rgba(0,0,0,0) 1px,
    rgba(0,0,0,.5) 2px,
    rgba(0,0,0,.1) 5px
  background-size: 100% 3px;
  animation: .1s interference steps(4) infinite;  

@keyframes interference {
  to {
    transform: translateY(-1em) translateZ($size*1.02);
@keyframes text {
  to {
    text-indent: -$text-width * 3;
@keyframes text-fade {
  0%, 25% {
    opacity: 0;
  75%, 100% {
    opacity: 1;

@keyframes scale {
  from {
    transform-origin: 50% 50% -200px;
@keyframes spinXY {
  0% {
    transform: rotateY(-90deg) rotateX(90deg) scaleZ(-1);
  24.999% {
    transform: rotateY(-180deg) rotateX(180deg) scaleZ(-1);
  25% {
    transform: rotateY(180deg) rotateX(-180deg) scaleX(-1) scaleY(-1) scaleZ(-1);
  49.999% {
    transform: rotateY(90deg) rotateX(-90deg) scaleX(-1) scaleY(-1) scaleZ(-1);
  50% {
    transform: rotateY(-90deg) rotateX(90deg);
  74.999% {
    transform: rotateY(-180deg) rotateX(0deg);
  75% {
    transform: rotateY(180deg) rotateX(0deg) scaleX(-1) scaleY(-1);
  100% {
    transform: rotateY(90deg) rotateX(-90deg) scaleX(-1) scaleY(-1);

@keyframes shade {
  0%, 50%, 100% {
    background-color: hsl(220, 30%, 15%);
    box-shadow: 0 0 8px hsl(220, 30%, 15%);
  22%, 28%, 72%, 78% {
    background-color: hsl(220, 100%, 85%);
    box-shadow: 0 0 8px hsl(220, 100%, 85%);
  25%, 75% {
    background-color: hsl(220, 100%, 100%);
    box-shadow: 0 0 8px hsl(220, 100%, 100%); 
🕑 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.