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

              
                <h1>WCAG-friendly Animated Link Indicators</h1>

<p>
  Based on <a href="https://codepen.io/Wongjn/pen/VwMBgZB" target="_top">Mouse-Out</a> by <a href="https://codepen.io/Wongjn" class="underline" target="_top">Justin Wong</a>.
</p>

<p>
  <a href="#">Multiline<br/>effect</a>
</p>
<p>
  <a href="#" class="underline">Underline<br/>version</a>
</p>
              
            
!

CSS

              
                body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;
  font-size: 200%;
  color: #000;
  background-color: #fff;
  /*   line-height: 1.5; */
  /*   letter-spacing: 0.12em; */
  /*   word-spacing: 0.16em; */
}

h1 {
  line-height: 1;
}

p:nth-of-type(2), p:nth-of-type(3) {
  text-align: center;
}

/* From the cited pen and edited. */

a {
  background: linear-gradient(0deg, #00f, #00f) no-repeat right bottom /
    0 var(--bg-h);
  /*  Moved to a feature query to detect motion settings.  */
  /* transition: background-size 350ms; */
  --bg-h: 100%;
  /*  Move the color to here since I killed other a.  */
  color: inherit;
  /*  Making the default underline a bit better.  */
  text-underline-offset: .1em;
  text-decoration-color: #00f;
}

/* If they have not shown a preference for reduced */
/* motion, then allow the transition to happen.    */
@media (prefers-reduced-motion: no-preference) {
  a {
    transition: background-size 350ms;
  }
}

a:where(:hover, :focus-visible) {
  background-size: 100% var(--bg-h);
  background-position-x: left;
  /*  Makes the text legible when the color covers it.  */
  color: #fff;
}

/* Added to explicitly address focus, though you could   */
/* change the previous selector to use :focus instead of */
/* :focus-visible and add this style there.              */
a:focus {
  outline: none;
}

/* Changed to relative units from px */
.underline {
  padding-bottom: .1em;
  --bg-h: .2em;
  color: inherit;
}

/* Just for a little extra on the underlined style. */
a.underline:where(:hover, :focus-visible) {
  text-decoration-style: dotted;
}


/* Do not need */
/* a {
  text-decoration: none;
  color: inherit;
  line-height: 1;
} */

/* Let's support Windows High Contrast Mode.  */
/* Makes underlines go dotted on hover/focus. */
/* Restores the focus outline as well.        */
@media screen and (-ms-high-contrast: active),
  screen and (forced-colors: active) {
    a:where(:hover, :focus-visible) {
      text-decoration-style: dotted;
    }
    a:focus {
      outline: none;
    }
}
              
            
!

JS

              
                  
              
            
!
999px

Console