Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div class=IMG>

  <h1 class=IMG_title>
    <span class=IMG_copy-1>Scaling</span>
    <span class=IMG_copy-2>font-size</span>
    <span class=IMG_copy-3>in</span>
    <span class=IMG_copy-4>prop<span>o</span>rtion</span>
    <span class=IMG_copy-5>to an</span>
    <span class=IMG_copy-6>image</span>
    <span class=IMG_copy-7><span>&harr;</span> Resize the window</span>

  <div class=IMG_bg></div>


<section class=credits>

    <li><a target=_blank title="[new window]" href="">Fluid-responsive font-size calculator</a></li>

    <li>Photo: <a target=_blank title="[new window]" href="">Marcus Castro</a></li>
    <li>Real world example: <a target=_blank title="[new window]" href="">Food Love Stories</a></li>
    <li>Dirty 'orrible 'acky <a target=_blank title="[new window]" href="">Safari resize fix</a></li>

    <li><a target=_blank title="[new window]" href="">Pens by Mike Foskett</a> &mdash; <a target=_blank title="[new window]" href="">webSemantics</a></li>




                /* Generic styling */
* {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
body {
  font-family: sans-serif;
  line-height: 1.5;
  background-color: #B5C6AF;
h1 {font-weight: 400}
.credits {margin: 2rem}
h2 {font-weight: 100}
ul {margin-left: 1rem}
li {margin: .5rem 0}
a {
  color: #000 !important;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: all .3s ease-out;
  outline: 0 solid transparent;
a:focus {
  background-color: #fff;
  outline: .25em solid #fff;

.IMG {
  position: relative;
  /* Maintain image aspect-ratio */
  height: calc(100vw * 12 / 16);

[class^="IMG_title"] {
  position: absolute;
  z-index: 1;
  color: #fff;
  text-transform: uppercase;
  font-size: 1rem;
  /* Fluid-responsive font-size calculator: */
  /* 1em(16px) @ 20em(320px) increasing to 2em(32px) @ 40em(640px) */
  font-size: calc(1rem + ((1vw - 0.2em) * 5));
  /* WCAG: Shadow to increase contrast around text edges */
  text-shadow: 0 0 3px #000;

[class^="IMG_copy"] {
  position: absolute;
  white-space: nowrap;
.IMG_copy-1 {
  top: 20vw;
  left: 3.5vw;
  font-size: 1.125em;
.IMG_copy-2 {
  top: 41vw;
  left: 3.2vw;
  font-size: 1em;
.IMG_copy-3 {
  top: 12vw;
  left: 55.75vw;
  font-size: 1.125em;
.IMG_copy-4 {
  top: 28.75vw;
  left: 36.1vw;
  font-size: 0.75em;
  .IMG_copy-4 span{
    font-size: 2.65em;
    vertical-align: middle;
    display: inline-block;
    color: rgb(255,255,255);
    animation: color-rotate 4s infinite;
  @keyframes color-rotate {
    50% {color: #6d3; transform: scale(1.5)}
.IMG_copy-5 {
  top: 19.25vw;
  left: 73vw;
  font-size: 0.7em;
.IMG_copy-6 {
  top: 33vw;
  left: 71.4vw;
  font-size: 0.85em;
.IMG_copy-7 {
  top: 65vw;
  left: 34vw;
  .IMG_copy-7 span {
    display: inline-block;
    color: rgb(255,255,255);
    font-size: 1.5em;
    margin-right: .125em;
    vertical-align: baseline;
    animation: color-rotate-scale 2s infinite;
  @keyframes color-rotate-scale {
    50% {color: #6d3; transform: scale(1.5, 1)}

.IMG_bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  /* Photo: Marcus Castro */
  background-image: url(;


                // Dirty 'orrible 'acky fix!
// Safari only - Fix for vw / vh units inside a Codepen iframe
(function () {
  var ua = navigator.userAgent.toLowerCase();
  if (ua.indexOf('safari') != -1) {
    if (!(ua.indexOf('chrome') > -1)) {

      // Safari only
      console.log("99 browsers but Safari's just one.");
      window.addEventListener("resize", function() {
      }, false);