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>
  <h1>Links are Great</h1>
  <h3>But not to style :( </h3>
  <p>
    I like the idea of having a <a href="#" class="oldstyle">link underlined</a>, because it makes them easily identifyable as a to read as a <a href="#" class="oldstyle">link</a>. But that makes them hard to imposisble to style. So what is the solution?
  </p>
  <p>
    This is a text. <a href="http://google.com">This one </a> is a link to google. It is short.
  </p>
  <p>
    <a href="http://bing.com">This is a long link to Bing, and it will take up more space, and also it will linebreak.</a>
  </p>
  <p>
    Want some more “out there” styling? <a href="http://moritzzimmer.com">This is a link to moritzzimmer.com, and it uses a background-image inside the pseudo element</a>, for maximum coolness
  </p>
  
</div>
              
            
!

CSS

              
                // gives each span tag contained within each a tag a :before pseudo element, which serves as the underline 
a{
  display: inline-flex; 
  flex-wrap: wrap;
}
a span{
  position: relative;
  z-index: 1;
  padding-right: 0.25em;

  &:before{
    position: absolute;
    width: 101%;
    height: 10px;
    bottom: 4px;
    left: 0;
    content: '';
    z-index: -1;
    opacity: 0.8;
    background-color: #fd0;
    transition: all 0.2s;
  }
}
// removes the standard underline, and on hover (over the a tag), apply new styling to the span:before pseudoelement
a{
  text-decoration: none;
  &:hover{
    span:before{
      background-color: #6045ff;
      opacity: 0.6;
      height: 2px;
      bottom: 2px;
    }
  }
}


// special styling for last span
p:last-of-type{
  width: 50%;
  background-color: white;
  border: 2px dashed #007888;;
  padding: 20px;
  a, a:visited{
    font-size: 20px;
    letter-spacing: 0.05em;
    line-height: 2em;
    span:before{
      opacity: 1;
      width: 110%;
      left: 0;
      height: 20px;
      bottom: -2px;
      background-color: transparent;
      background-image:url('https://portfolio.moritz.blue/wp-content/uploads/2021/12/qcBoqoK4i.jpg');
      background-size: 100px;
      background-position: center center;
    }
  }
  a{
    text-decoration: none;
    &:hover{
      span:before{
        transform: scale(1, 1.5);
        opacity: 0.7;
        filter: blur(2px);
      }
    }
  }
}





// General styling, not that important
body{ margin: 0; padding: 0; background: #9c00fc}
div{
  background-color: #f5f3f4;
  color: #345;
  font-family: 'KambriWeb3', Helvetica, Arial, sans-serif;
  letter-spacing: 0.02em;
  font-size: 30px;
  padding: 2% 5%;
  width: 75%;
  margin: 0 auto;
  box-shadow: 0 0 100px rgba(0,0,0,0.4);
}
h1, h3{
  margin: 0;
  padding: 0;
}
p:nth-of-type(3){
  width: 250px;
}
a, a:visited{
  color: #6045ff;
}
a.oldstyle{
  text-decoration: underline;
  span:before{
    display: none;
  }
}

              
            
!

JS

              
                /**
 * Initializes automatically on document ready
 * Called here on all anchor tags that 
 * don't have the class oldstyle!
 */
$(function(){
  scrollimate.saUnderline( $('a:not(".oldstyle")') );
});
              
            
!
999px

Console