Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.


              <div class="page-wrapper">  
  <div class="container">   
      <img src="http://natalieolivo.github.io/imgs/girl.jpg" class="absolute-center is-image" />


              /* Discovered that this doesn't work if the natural image height extends the height of the container */
.page-wrapper {
  background: pink;
  width: 100%;
  height: 1000px;

.container {
  background: grey;
  width: 60%;
  height: 30%;
  box-sizing: border-box;
  position: relative;
  margin: 0 auto;

/* this works charmingly for vertical centering
if a variable height is not necessary, since height
needs to be specified */
.absolute-center {
  margin: auto;
  position: absolute;
  width: 40%;
  padding: 18px;    
  top: 0; left: 0; bottom: 0; right: 0;
.absolute-center.is-image {
  height: auto;
  display: block;
.absolute-center.is-image img {
  width: 100%;
  height: auto;  
.box-style {
  background: white;
  border: solid 3px #333; 
  box-shadow: 0 3px 8px #333;



Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................