cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

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

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

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.

            
              <div class="container pseudo">
  <img src="http://placebeyonce.com/200-300">
  <div class="children">
    <h1>CSS2 pseudo-element</h1>
    <p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor.</p>
  </div>    
</div>

<div class="container flex">
  <img src="http://placebeyonce.com/200-300">
  <div class="children">
    <h1>Flexbox 1</h1>
    <p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor.</p>
  </div>    
</div>

<div class="container flex2">
  <img src="http://placebeyonce.com/200-300">
  <div class="children">
    <h1>Flexbox 2</h1>
    <p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor.</p>
  </div>    
</div>

<div class="container translate">
  <div class="children">
    <h1>Transforms</h1>
    <p>En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga antigua, rocín flaco y galgo corredor.</p>
  </div>    
</div>
            
          
!
            
              .container {
  background: #ccc;
  border: 1px solid #999;
  margin: 20px;
}
.container img {
  vertical-align: middle;
}
.children {
  width: 300px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid #999;
  background: #eee;
}

.pseudo {
  text-align: center;  
}
.pseudo:before {
  content: '';
  display: inline-block;
  height: 100%; 
  vertical-align: middle;
  margin-right: -0.25em; /* Adjusts for spacing */ 
} 
.pseudo .children {
  display: inline-block;
  vertical-align: middle;
}

.flex {
  align-items: center;
  display: flex;
}

.flex2 {
  display: flex;
}
.flex2 .children {
  margin: auto;
}

.translate {
  height: 300px;
}
.translate .children {
  position: relative;
  transform: translateY(-50%);
  top: 50%;
}
            
          
!
999px
Close

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.

Go PRO

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

Console