Pen Settings

HTML

CSS

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

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

              
                <div class="ancatomy">

  <img src="//placekitten.com/510/610" alt="Cute kitten.">
  
  <h1 class="sr-only">Why cats are cute</h1>
  
  <ul>
    <li class="cute-bit cute-ears grow-left">
      <h2>
        Pointy Ears
      </h2>
      <p>
        For listening to burdz
      </p>
    </li>

    <li class="cute-bit cute-eyes grow-left">
      <h2>
        Beady Eyes
      </h2>
      <p>
        For keeping a lookout for<br>
        mice or other tasty noms
      </p>
    </li>

    <li class="cute-bit cute-nose grow-right">
      <h2>
        Snuffly Nose
      </h2>
      <p>
        For smelling when food is near
      </p>
    </li>

    <li class="cute-bit cute-paws grow-right">
      <h2>
        Super<br>
        Adorbs Paws
      </h2>
      <p>
        For smacking things off tables
      </p>
    </li>

  </ul>
  
</div>
              
            
!

CSS

              
                body {
  background: #919793;
  padding: 2em
}
ul {
  padding: 0;
  margin: 0;
  list-style: none;
  // reduce opacity of non-hovered bit
  &:hover {
    .cute-bit {
      opacity: 0.5;
      &:hover {
        opacity: 1;
      }
    }
  }
}
.ancatomy {
  position: relative;
  text-align: center;
  font-size: 1vw;
  color: #fff;

  img {
    display: block;
    width: 30em;
    margin: 0 auto;
  }

  .cute-bit {
    position: absolute;
    min-width: 15em;
    transition: all 0.25s ease-out;
    &:hover {
      // !important here allows custom base value with consistent hover
      min-width: 21em !important;
    }
    
    // REFACTOR OPPORTUNITY:
    // pad both sides, then
    // add matching before/after & hide as needed
    &.grow-left {
      text-align: left;
      h2 {
        padding-right: 1em;
        &:after {
          right: 0;
          transform: translate(50%, 50%);
        }
      }
    }
    &.grow-right {
      text-align: right;
      h2 {
        padding-left: 1em;
        &:after {
          left: 0;
          transform: translate(-50%, 50%);
        }
      }
    }
    
    h2 {
      position: relative;
      padding: 0 0 0.4em;
      border-bottom: solid 0.2em;
      margin: 0 0 0.4em;
      text-shadow: 0 0 1em 1em rgba(0,0,0,0.1);
      &:after {
        position: absolute;
        bottom: -0.1em;
        content: "";
        width: 1em;
        height: 1em;
        border-radius: 50%;
        background: #fff;
      }
    } // h2
    p {
      margin: 0;
      padding: 0;
      text-shadow: 0 0 1em 1em rgba(0,0,0,0.1);
    }

    &.cute-ears {
      right: 43%;
      top: 8%;
      // custom value only applies to non-hover
      min-width: 12em;
    }
    &.cute-eyes {
      right: 58%;
      top: 44%;
    }
    &.cute-nose {
      left: 47.5%;
      top: 55%;
      // custom value only applies to non-hover
      min-width: 16em;
    }
    &.cute-paws {
      left: 39%;
      bottom: 10%;
    }
  } // .cute-bit
  
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console