cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <h2><a href="#" data-text="Here is a test title">Here is a test title</a></h2>

<h2><a href="#" data-text="Here is a slightly longer title. We’ll see how it fares.">Here is a slightly longer title. We’ll see how it fares.</a></h2>

<h2><a href="#" data-text="Here is an even longer title that should start to test things decently. I’m not sure I would ever have a title this long, but there you go.">Here is an even longer title that should start to test things decently. I’m not sure I would ever have a title this long, but there you go.</a></h2>

<h2><a href="#" data-text="Here is a title that is beyond all titles. It carries on and on. Nihilism would state that this title does not deserve to exist. But nihilism is wrong, my friends, for carry on it does — all the way to the edge of the viewport.">Here is a title that is beyond all titles. It carries on and on. Nihilism would state that this title does not deserve to exist. But nihilism is wrong, my friends, for carry on it does — all the way to the edge of the viewport.</a></h2>
            
          
!
            
              $line-height: 1.2;
$lines: 3;

h2 {  
  line-height: $line-height;
  max-height: $lines * $line-height * 1em; //exact number of lines
  overflow: hidden;
  
  margin-bottom: 2em;
}

a {
  display: inline-block;
  max-height: ($lines + 1) * $line-height * 1em; //one more line
  position: relative;

  // webkit solution to multi-line text overflow
  display: -webkit-box;
  -webkit-line-clamp: $lines;
  -webkit-box-orient: vertical;

  &:before { // for the ellipsis
    background: #fff; // fallback for old IE
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 50%);
    bottom: $line-height * 1em;
    content: '\02026';
    height: $line-height * 1em;
    position: absolute;
    right: 0;
    text-align: right;
    width: 4em;
  }

  &:after { // to cover all but the last line of text
    background: #fff;
    content: attr(data-text);
    left: 0;
    height: ($lines - 1) * $line-height * 1em;
    overflow: hidden;
    position: absolute;
    top: 0;
    width: 100%;
  }

  @supports (-webkit-line-clamp: 2) {
    &:before, &:after {
      content: none;
    }
  }
  
  color: #00b;
  text-decoration: none;
  transition: color .3s ease-in-out;
  &:hover, &:focus, &:active {
    color: #b00;
  }
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console