cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-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="contain">
  <div id="ponyo">
    <h1>@include centerEl;</h1>
    <p>With this SCSS mixin you'll be able to horizontally AND vertically center blocks of text dynamically, with ease</p>

<div class="contain">
  <div id="billmurray">
    <p>To use it, just <code>@include centerEl</code></p>
    <p>You can set some properties through parameters too, like the <code>left</code> position, <code>width</code> and <code>text-align</code>.</p>
    <p><small>Defaults: <code>$left: 50%, $width: 50%, $align: center</code></small></p>

<div class="contain">
  <div id="jeffgolenski">
    <p>But you don't have to horizontally align if you don't want to. Just include the mixin like this...</p>
    <code>@include centerEl($left: 95%, $align: left);</code>

<div class="contain">
  <div id="poppop">
    <p>Or you can include the mixin like this...</p>
    <code>@include centerEl($left: 5%, $width: auto, $align: left);</code>

<div class="contain">
  <div id="cred">
    <p>Forked and adapted from a <a href="http://jsfiddle.net/jeffgolenski/hchhT/13/" target="_blank">Fiddle</a> by <a href="https://twitter.com/jeffgolenski" target="_blank">@jeffgolenski</a></p>
              $base: #94c6fd;

@function dynamicColor ($color) {
  @if ( lightness($color) < 50% ) {
    @return #eee;
  } @else {
    @return #111;

@mixin centerEl ( $left: 50%, $width: 50%, $align: center ) {
  position: absolute;
  top: 50%;
  left: $left;
  -ms-transform: translate($left * -1,-50%);
  -webkit-transform: translate($left * -1,-50%);
  transform: translate($left * -1,-50%);
  width: $width;
  > * {
    display: block;
    padding: 0 10px;
    text-align: $align;
    width: 100%;

:root {
  background: $base;
  padding: 3em;
  .contain {
    background: white;
    box-shadow: 0 2px 2px darken($base, 15%);
    color: #111;
    font-size: 1.3em;
    height: 300px; max-width: 1000px; width: 100%;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(black, 0.4);
    position: relative;
    + .contain {
      margin-top: 3em;
    a {
      color: dynamicColor($base);

#ponyo, #billmurray {
  @include centerEl;

#jeffgolenski {
  @include centerEl($left: 95%, $align: left);

#poppop {
  @include centerEl($left: 5%, $width: auto, $align: left);

#cred {
  @include centerEl($width: 80%)

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 ..................