Pen Settings

HTML

CSS

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

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.

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

Behavior

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.

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                .container
  .laptop
    .screen
    .base
  .cup
  .steam
    div
    div
    div
              
            
!

CSS

              
                $body: grey
$lid: #fafafa
$screen: #555
$base: #fafafa
$border: #666
$cup: rgb(0,90,160)
$handle: rgb(0,90,160)

body
  background: $body
  
  .container
    position: relative
    height: 240px
    width: 500px
    margin: auto
    margin-top: 100px
    
    &::after
      content: ""
      position: absolute
      top: 216px
      left: 10px
      width: 480px
      border: 3px solid rgba(0, 0, 0, 0.2)
      border-radius: 0px 0px 50% 50%
    
    &::before
      content: ""
      position: absolute
      top: 218px
      left: 25px
      height: 5px
      width: 450px
      background: #C8DBFE
      border-radius: 50%
    
    .laptop
      //display: none
      position: absolute
      height: 100%
      width: 100%
      //background: peachpuff
      z-index: 100
      
      
      .screen
        position: absolute
        left: 115px
        top: 0px
        height: 200px
        width: 300px
        background: $lid
        border-radius: 12px 12px 0px 0px
        border: 3px solid $border
        box-sizing: border-box
        
        &::after, &::before
          content: ""
          position: absolute
        
        &::after
          top: 20px
          left: 8px
          height: 162px
          width: 278px
          background: $screen
          border: 3px solid $border
          box-sizing: border-box
        
        &::before
          top: 5px
          left: calc(50% - 4px)
          height: 8px
          width: 8px
          background: #777
          border-radius: 50%
        
      .base
        position: absolute
        top: 198px
        left: 85px
        height: 18px
        width: 360px
        background: $base
        border-radius: 0px 0px 15px 15px
        border: 3px solid $border
        box-sizing: border-box
        
        &::after
          content: ""
          position: absolute
          left: 135px
          height: 4px
          width: 90px
          background: #fff
          border-radius: 0px 0px 8px 8px
          background: #ddd
          border: 2px solid $border
          box-sizing: border-box
          border-top: none
        
    .cup
      position: absolute
      top: 136px
      left: 30px
      height: 80px
      width: 75px
      background: $handle
      border-radius: 0px 0px 10px 10px
      border: 3px solid $border
      box-sizing: border-box
      
      &::after, &::before
        content: ""
        position: absolute
        
      &::after
        left: -30px
        top: 4px
        height: 55px
        width: 60px
        background: $cup
        z-index: -10
        border-radius: 50%
        border: 3px solid $border
      
      &::before
        left: -20px
        top: 14px
        height: 41px
        width: 40px
        background: $body
        border: 3px solid $border
        border-radius: 50%
        z-index: -5
        box-sizing: border-box
      
  .steam
    position: absolute
    top: 130px
    left: 45px
    width: 45px
    height: 30px
    display: flex
    justify-content: space-around
    z-index: -1
    opacity: 0
    animation: steam 3s linear infinite
    
    div
      height: 30px
      width: 10px
      background: #fff
      border-radius: 10px 0px 10px 0px
      
  @keyframes steam
    
    20%
      opacity: 0.6
    
    35%
      top: 100px
      opacity: 0.6
    
    70%
      top: 70px
      opacity: 0
              
            
!

JS

              
                
              
            
!
999px
If a groundhog inspects their Web Component, do they see their Shadow DOM?

Console