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.

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.

HTML

              
                //- how to vertical align an image (not knowing height and width)

// 1. use inline-block 0 width helper to vertical align an image
.wrap
 .helper
 img(src="https://avatars1.githubusercontent.com/u/2057060?v=3&s=460", alt="")

// 2. trick way top 0 bottom 0 right 0 left 0
.wrap2
 img(src="https://upload.wikimedia.org/wikipedia/commons/5/52/Mount_Ellinor,_Mount_Washington_Panorama.jpg", alt="")
 
// 3. transform translateY -50%
.wrap3
  img(src="https://avatars1.githubusercontent.com/u/2057060?v=3&s=460", alt="")
              
            
!

CSS

              
                .wrap
  height 100px
  width 100px
  border 1px solid
  text-align center
  .helper
    display inline-block
    height 100%
    vertical-align middle
  img
    display inline-block
    max-height 100px
    max-width 50px
    vertical-align middle
    
 .wrap2
    position relative
    height 100px
    width 100px
    border 1px solid
    img
       position absolute
       max-width 100%
       max-height 100%
       top 0
       bottom 0
       right 0
       left 0
       margin auto
       
.wrap3
  position relative
  width 100px
  height 100px
  border 1px solid
  text-align center
  img
    position relative
    top 50%
    transform translateY(-50%)
    max-width 60px
    max-height 100px
    
  
    
  
              
            
!

JS

              
                
              
            
!
999px

Console