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

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.

HTML

              
                <div class="flex-wrapper">
  <a href="" class="one">
    <div class="overlay">
      <div class="overlay-inner">
        <h2>Title #1</h2>
        <p>Fusce vulputate orci at nulla consequat, ac tincidunt quam ultrices.</p>
      </div>
    </div>
  </a>
  <a href="" class="two">
    <div class="overlay">
      <div class="overlay-inner">
        <h2>Title #2</h2>
        <p>Quisque facilisis enim eu mi condimentum, id interdum diam pharetra.</p>
      </div>
    </div>
  </a>
  <a href="" class="three">
    <div class="overlay">
      <div class="overlay-inner">
        <h2>Title #3</h2>
        <p>Donec laoreet enim sed risus suscipit, rutrum egestas ligula tristique.</p>
      </div>
    </div>
  </a>
  <a href="" class="four">
    <div class="overlay">
      <div class="overlay-inner">
        <h2>Title #4</h2>
        <p>Etiam porta, enim non vulputate consectetur, neque lectus finibus erat, eu. </p>
      </div>
    </div>
  </a>
  <a href="" class="five">
    <div class="overlay">
      <div class="overlay-inner">
        <h2>Title #5</h2>
        <p>Cras nunc augue, egestas sed maximus non, consectetur in nunc.</p>
      </div>
    </div>
  </a>
</div>
              
            
!

CSS

              
                body {
  font: normal 18px/1.5 "Helvetica Neue", sans-serif;
}

.flex-wrapper {
  display: flex;
  height: 100vh;
}

.flex-wrapper a {
  position: relative;
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: flex .4s;
}

.flex-wrapper .one {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/nav-001.jpg);
  background-color: red;
}

.flex-wrapper .two {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/nav-002.jpg);
  background-color: green;
}

.flex-wrapper .three {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/nav-003.jpg);
  background-color: steelblue;
}

.flex-wrapper .four {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/nav-004.jpg);
  background-color: orange;
}

.flex-wrapper .five {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/210284/nav-005.jpg);
  background-color: tomato;
}

.flex-wrapper a:hover {
  flex: 3;
}

.flex-wrapper .overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transition: background-color .4s;
}

.flex-wrapper a:hover .overlay {
  background-color: rgba(0, 0, 0, .5);
}

.flex-wrapper .overlay-inner * {
  visibility: hidden;
  opacity: 0;
  transform-style: preserve-3d;
}

.flex-wrapper .overlay h2 {
  transform: translate3d(0, -60px, 0);
}

.flex-wrapper .overlay p {
  transform: translate3d(0, 60px, 0);
}

.flex-wrapper a:hover .overlay-inner * {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: all .3s .3s;
}
              
            
!

JS

              
                
              
            
!
999px

Console