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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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;

  &: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%;
  }
  
  color: #00b;
  text-decoration: none;
  transition: color .3s ease-in-out;
  &:hover, &:focus, &:active {
    color: #b00;
  }
}
            
          
!
999px
Loading ..................

Console