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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


  <h2>Multi-line Elipsis with Cross-Browser Fallback - Pure CSS</h2>
    <p>The text below will be truncated with an ellipsis in browsers that support <code>-webkit-line-clamp</code> (currently Chrome, Safari, Opera, iOS Safari and Android/Chrome Androide) and will show a faded gradient on those that don't (like IE, Edge, Firefox and Opera Mini).</p>
  <div class="container">
    <p class="clampMe">There's a lot more text in here than what you'll ever see. Pellentesque habitant testalotish morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
  <div class="container">
    <p class="clampMe">Not much text? No clipping.</p>
  <div class="container">
    <p class="clampMe">Just a couple of lines of text? It'll likely be shown in its entirety on a wider window but as you shrink down it'll continue to truncate to two lines like you'd expect. That's the difference between this and other solutions I've seen.</p>
  <p>If you aren't limited to a CSS only solution, I've written a <a href="">Javascript and CSS version that you can find here</a>.</p>


                /******* THE FLUFF *******/

/* Up here is all the styles to make this pen not look crappy. The meat of this is down below. */
@import ',300,400,700';

body {
  font-family: Raleway;
  font-weight: 400;
  background: lavender;
  display: flex;
  justify-content: center;

section {
  width: 80%;
  margin: auto;

h2 {
  text-align: center;

.container {
  border: 1px solid lightGrey;
  padding: 0 1.5em;
  border-radius: 3px;
  background: #fff;
  margin-bottom: 2em;

/****** THE GOOD STUFF *******/

/* OK, here's the good stuff. Start with fallback for browsers that don't support -webkit-line-clamp */
.clampMe {
  position: relative;
  height: 2.4em; 
  overflow: hidden;

.clampMe:after {
  content: "";
  text-align: right;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 1.2em;
  background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 80%);

/* Now add in code for the browsers that support -webkit-line-clamp and overwrite the non-supportive stuff */
@supports (-webkit-line-clamp: 2) {
  .clampMe {
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
  .clampMe:after {
    display: none;