Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="container">
  <div class="full-width">
    <p>Hover any button to see the effect</p>
    <a href="#" class="button block">Really wide button link</a>
  </div>
<ul>
  <li>
    <a href="#" class="button">Button link</a>
  </li>
  <li>
    <a href="#" class="button">Verbose button link lorem ipsum dolor sit amet this is a remarkably long button</a>
  </li>
  <li>
    <a href="#" class="button">Go</a>
  </li>
</ul>
<ul>
  <li>
    <button>Button element</button>
  </li>
  <li>
    <button>Verbose button element lorem ipsum dolor this is too many words for a button</button>
  </li>
  <li>
    <button>Go</button>
  </li>
</ul>
<ul>
  <li>
    <input type="button" value="Input element button" />
  </li>
  <li>
    <input type="submit" value="Input element submit" />
  </li>
  <li>
    <input type="reset" value="Input element reset" />
  </li>
  <li>
    <input type="submit" value="Verbose input element submit lorem ipsum dolor sit amet just a few more so it wraps" />
  </li>
  <li>
    <input type="submit" value="Go" />
  </li>
</ul>
</div>

<div class="notes">
  <h2>Notes</h2>
  <p>
    This demo prioritizes uniformity across the buttons, which sacrifices uniformity in the animation speed. It's subtle, but the animation on the wide buttons runs "faster" than on the really short ones (technically they're the same 0.3s, but the long ones have more ground to cover in the same timeframe).
  </p>
  <p>
    In the use case for this effect, this is a fair trade off because it was much more important that the triangles remain the same size in the init state regardless of button height - many were used in stacked lists and a height difference would have looked broken.
  </p>
  <p>
    In cases where apparent animation speed differences are a dealbreaker, the gradient could be adjusted to be completely relative (removing any explicit pixel values) - it would just render different sized "triangles" depending on the button's size.
  </p>
</div>
              
            
!

CSS

              
                .button,
a.button,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  // reset defaults
  border: 0;
  font-size: 1em;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;
  
  // container styles, mninus the bg gradient
  display: inline-block;
  padding: 1em 2em;
  transition: all 0.3s ease-in-out;
  
  // typography
  color: #fff;
  font-family: sans-serif;
  text-align: center;
  
  // build the background init state
  background-color: deeppink;
  background-image: linear-gradient(135deg, darkmagenta 50%, deeppink 50%);
  background-repeat: no-repeat;
  background-size: 200% 50px;
  background-position: 100% 0;
  
  &:hover,
  &:active,
  &:focus {
    background-color: darkmagenta;
    background-size: 320% 200%;
    background-position: 0 100%;
  }
  
  // long button for testing
  &.block {
    display: block;
  }
}

// ----------------------
// pretty demo formatting
body {
  font-family: sans-serif;
}

p {
  font-size: 1.2em;
  margin-bottom: 2em;
}

.container {
  @media screen and (min-width: 768px) {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
  }
  & > * {
    flex: 0 1 30%;
  }
  .full-width {
    flex: 0 1 100%;
    margin-bottom: 2em;
  }
}
ul {
  padding: 0;
  margin: 0;
  li {
    list-style: none;
    margin-bottom: 2em;
  }
}

.notes {
  @media screen and (min-width: 768px) {
    max-width: 700px; 
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console