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="wrap">
    <h2>Simple</h2>
    <p><a href="#" class="underlined underlined--thin">I'm a very long text and it was a pain in the ass to animate an underline effect - but jeez it's such a simple snippet at the end.</a></p>
  
  <h2>Let's play with the thickness of this underline</h2>
 <p><a href="#" class="underlined underlined--thick">I'm an other very long highlighted link.</a></p>
  
  <h2>But I want it a bit higher compared to the baseline</h2>
 <p><a href="#" class="underlined underlined--offset">I'm an other very long link and I'm an artist you know.</a></p>
  
  <h2>Let's play with the gradient</h2>
  <a href="#" class="underlined underlined--gradient">PICKLE RIIIICK</a>
  
  <h2>Oooh fancy</h2>
 <p><a href="#" class="underlined underlined--reverse">I'm an other long link and I don't like lorem.</a></p>
</div>  
              
            
!

CSS

              
                // Just to make it a bit nice
body {
  font-family: 'Source Code Pro', sans-serif;
}
.wrap {
  padding: 10% 20%;
}
h2 {
  margin-top: 3em;
  color: grey;
  &:first-child {
    margin-top: 0;
  }
}

// Now that is interesting
.underlined {
  color: black;
  flex: 1;
  font-size: 2em;
  line-height: 1.2;
  text-decoration: none;
  background-image: linear-gradient(to right, yellow 0, yellow 100%);
  background-position: 0 1.2em;
  background-size: 0 100%;
  background-repeat: no-repeat;
  transition: background .5s;
  &:hover, {
    background-size: 100% 100%;
  }
  &--thin {
    background-image: linear-gradient(to right, black 0, black 100%);
  }
  &--thick {
    background-position: 0 -0.3em;
  }
  &--offset {
    background-position: 0 0.2em;
    //didn't find another solution than mask the underline shape by a box shadow with the same color than the bg
    box-shadow: inset 0 -.5em 0 0 white;
  }
  &--gradient {
    background-position: 0 -0.1em;
    background-image: linear-gradient(to right, yellow 0, lightgreen 100%);
  }
  &--reverse {
    background-position: 100% -0.1em;
    transition: background 1s; //yep, that's a long link
    background-image: linear-gradient(to right, yellow 0, yellow 100%);
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console