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

              
                <div></div>
              
            
!

CSS

              
                /* --- Universal Box Sizing with Inheritance --- */
html {
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* --- Colours --- */
$gl: #ffe3e0;
$g: #ffdcd8;
$gd1: #dcb1ab;
$gd2: #986962;
$gd3: #643b35;
$w: #f3f0f2;
$b: #060200;
$bd: #000;
$t: transparent;

/* --- Styles --- */
body {
  margin: 0;
  min-height: 100vh;
  position: relative;
}

div,
div::before,
div::after {
  position: absolute;
  background-repeat: no-repeat;
}

div,
div::before {
  border-radius: 3.4vmin 3.6vmin / 3.8vmin 3.6vmin;
  top: 50%;
  left: 50%;
  height: 90vmin;
  width: 62.2vmin;
}

div {
  /* --- back --- */
  transform: translate3d( -60%, -50%, 0 );
  box-shadow:
  // background
  inset 0 0.2vmin 1vmin 0.4vmin rgba( $gd3, 0.3 ),
  inset -0.5vmin 0.1vmin 0.1vmin 0.1vmin $gd3,
  inset -1vmin -1.2vmin 1vmin 0.1vmin rgba( $gd3, 0.6 ),
  inset 0 -0.05vmin 0.3vmin 0.1vmin $gd3,
  inset -2vmin 0.5vmin 0.2vmin 0.3vmin rgba( $gd1, 0.4 ),
  inset 0.2vmin 0 1vmin 0 rgba( $gd2, 0.8 ),
  inset 0.4vmin 1.5vmin 0.6vmin 1.2vmin rgba( $gl, 0.5 ),
  -1.5vmin 0.4vmin 2.5vmin 0 rgba( $gd2, 0.2 );
  background:
    // top holes
    radial-gradient( circle at 13% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 14.5% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 16% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 17.5% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 19% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 20.5% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 22% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 23.5% 0.2%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    // bottom holes
    radial-gradient( circle at 23.5% 99.9%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 25% 99.9%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 26.5% 99.9%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    radial-gradient( circle at 28% 99.9%, $bd 0.3vmin, $t calc( 0.3vmin + 1px )),
    // lens black
    radial-gradient( circle at 6.1% 3.8%, #3a4d67 0.2vmin, $t calc( 0.2vmin + 1px )),
    radial-gradient( circle at 5.8% 4.4%, #487f9e 0.1vmin, $t 0.35vmin ),
    radial-gradient( circle at 6% 4.1%, #253044 0.4vmin, #253044 calc( 0.4vmin + 1px ), #131919 0.9vmin, $b 1.3vmin, $g 1.44vmin, $t 1.5vmin ),
    radial-gradient( circle at 5.8% 2.1%, $g 0.8vmin, $t 1.7vmin ),
    radial-gradient( circle at 7% 3.6%, darken( $gd2, 35 ) 0.5vmin, $t 1vmin ),
    radial-gradient( circle at 4.9% 4.5%, darken( $gd2, 35 ) 0.5vmin, $t 1vmin ),
    radial-gradient( circle at 7% 4.4%, $gd2 0.7vmin, $t 1vmin ),
    radial-gradient( circle at 6% 4.1%, $g 1.5vmin, rgba( $gd2, 0.6 ) 1.6vmin, $t 1.75vmin ),
    // lens white
    radial-gradient( circle at 6% 7.7%, #d8d1b0 0.1vmin, $t calc( 0.1vmin + 1px) ),
    radial-gradient( circle at 6.2% 7.5%, #d8d1b0 0.1vmin, $t calc( 0.1vmin + 1px) ),
    radial-gradient( circle at 6% 7.6%, #eae7d0 0.1vmin, #ece3d1 0.2vmin, #f9f7ea .4vmin, $t 0.55vmin ),
    radial-gradient( circle at 6.2% 7.5%, $gd2 0.4vmin, $t 0.55vmin ),
    radial-gradient( circle at 5.8% 7.7%, $gd2 0.4vmin, $t 0.55vmin ),
    radial-gradient( circle at 6% 7.6%, rgba( $gd2, 0.3 ) 0.7vmin, $t calc( 0.7vmin + 1px)),
    //side buttons
    radial-gradient( circle at -0.2% 8.3%, $g 0.6vmin, $t 0.7vmin ),
    radial-gradient( circle at -0.1% 8%, $b 0.6vmin, $t 0.7vmin ),
    linear-gradient( $t 1%, $g 2%, $g 8%, $t 8% ),
    radial-gradient( circle at -0.2% 16.2%, $g 0.6vmin, $t 0.7vmin ),
    radial-gradient( circle at -0.1% 16.5%, $b 0.6vmin, $t 0.7vmin ),
    radial-gradient( circle at 0.6% 11.5%, $b 0.15vmin, $t 0.3vmin ),
    radial-gradient( circle at 0.6% 13%, $b 0.15vmin, $t 0.3vmin ),
    linear-gradient( $t 16.8%, $g 17%, darken( $gd1, 5 )),
    linear-gradient( 90deg, $t 0.7%, $gd2 0.9%, $t 1.2% ), /* brown v line */
    //top knob
    radial-gradient( circle at 6.2% 0.2%, $g 0.25vmin, $t calc( 0.25vmin + 1px )),
    radial-gradient( circle at 5.7% 0.2%, $bd 0.25vmin, $t calc( 0.25vmin + 1px )),
    radial-gradient( circle at 10.3% 0.2%, $g 0.25vmin, $t calc( 0.25vmin + 1px )),
    radial-gradient( circle at 10.8% 0.2%, $bd 0.25vmin, $t calc( 0.25vmin + 1px )),
    linear-gradient( 90deg, $g, $g 5.6%, $t 5.8%, $t 10.7%, $g 10.9% ),
    linear-gradient( $t 0.4%, $b 0.6%, $t 0.8% ), /* brown h line */
    $g;

  /* --- front --- */
  &::before {
    content: '';
    display: block;
    transform: translate3d( -25%, -50%, 0 );
    box-shadow:
    -0.3vmin 0.5vmin 1vmin 0 rgba( $gd3, 0.6 ),
    -3vmin 1vmin 3vmin -1vmin rgba( $gd2, 0.6 );

    background:
    // four corner shine
    radial-gradient( circle at 1.6% 1.6%, $gl 0.2vmin, $t 1.3vmin ),
    radial-gradient( circle at 97.5% 1.7%,  $gl .5vmin, $t 1.3vmin ),
    radial-gradient( circle at 97.8% 99.3%, $gl 0.7vmin, $t 1.3vmin ),
    radial-gradient( circle at 2% 98%, $gl 0.6vmin, $t 1.3vmin ),
    // background gradients
    linear-gradient( 90deg, $t 2%, $gd3 2.5%, $gd1 15%, $g, $gd1 78%, $gd3 90%, $gd2, $t 99% ),
    linear-gradient( $gl 1.5%, $gd3 2%, $gd1 15%, $g, $gd1 70%, $gd3 98%, $gl ),
    $g;
  }

  // /* --- screen --- */
  &::after {
    content: '';
    height: 89.2vmin;
    width: 61.1vmin;
    top: 50%;
    left: 58.2%;
    display: block;
    border-radius: 3vmin 2.8vmin / 3.6vmin 3.2vmin;
    transform: translate3d( -33%, -50%, 0 );
    box-shadow:
      // thin outline border
      0.1vmin 0.1vmin 0 0 $gd1,
      -0.1vmin -0.08vmin 0 0 $gd1;
    background:
      // camera
      radial-gradient( circle at 50.1% 3.4%, rgba( $w, 0.4 ) 0.1vmin, $t 0.5vmin ),
      radial-gradient( circle at 50% 3.5%, $b 0.35vmin, $t 0.55vmin ),
      // home button
      radial-gradient( circle at 50% 96.8%, $w 1.5vmin, $t calc( 1.5vmin + 1px) ),
      radial-gradient( circle at 51.2% 97.1%, $g 0.8vmin, $t 1.3vmin ),
      radial-gradient( circle at 49% 97.1%, $g 0.8vmin, $t 1.3vmin ),
      radial-gradient( circle at 50.9% 96.9%, $gd1 1.3vmin, $t 1.6vmin ),
      radial-gradient( circle at 49.2% 97.1%, $gd1 1.2vmin, $t 1.6vmin ),
      radial-gradient( circle at 50% 96.9%, $gd2 1.9vmin, $t calc( 1.9vmin + 1px) ),
      // white part
      linear-gradient( #f3f0f3 6.5%, $t 6.85%, $t 93%, $w 93.2% ),
      linear-gradient( 90deg, $w 2.9%, $t 3.3%, $t 96.8%, $w 97.2% ),
      linear-gradient( $b 6.6%, $t 6.9%, $t 92.8%, $b 93.3% ),
      linear-gradient( 90deg, $b 3.1%, $t 3.5%, $t 96.6%, $b 97.2% ),
      // screen
      linear-gradient( 247deg, rgba( $w, 0.1 ) 40%, $t 40.2% ),
      linear-gradient( -20deg, $t 30%, rgba( #48d8a4, 0.5 ) 30.2%, $t 80% ),
      linear-gradient( 150deg, #ec008c, $t 50% ),
      linear-gradient( 80deg, #10afe0 5%, $t 65% ),
      linear-gradient( 160deg, #3a5cec 10%, #eeb4aa );
  }
}

              
            
!

JS

              
                // Twitter @anniebombanie_
              
            
!
999px

Console