Pen Settings

HTML

CSS

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

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 class="demo-grid">
    <div class="demo-card">
        <img width="200" height="200" src="https://placekitten.com/200/200?image=1" alt="" class="demo-img">
        <h1 class="line-clamp demo-title">
            Spill litter box, scratch at owner, destroy all furniture, especially couch
        </h1>
    </div>

    <div class="demo-card">
        <img width="200" height="200" src="https://placekitten.com/200/200?image=2" alt="" class="demo-img">
        <h1 class="line-clamp demo-title">
            Claws in the eye of the beholder
        </h1>
    </div>

    <div class="demo-card">
        <img width="200" height="200" src="https://placekitten.com/200/200?image=3" alt="" class="demo-img">
        <h1 class="line-clamp demo-title">
            Relentlessly pursues moth eat too much then proceed to regurgitate all over living room carpet while humans eat dinner
        </h1>
    </div>
</div>
<!-- Titles via http://www.catipsum.com/ -->
              
            
!

CSS

              
                /* By default, truncate the text abruptly */
.line-clamp {
    /* Careful computing the max-height, it needs to match n * line-height */
    max-height: calc(2 * 1.15 * 1.5rem);
    overflow: hidden;
}

/* For capable browsers, truncate with an ellipsis */
/* To simulate a browser without support, you can add a s after clamp in the following line */
@supports (-webkit-line-clamp: 2) {
    .line-clamp {
        /* Remove the made up max-height */
        max-height: none;
        
        /* Those three properties are mandatory, so is overflow: hidden that we defined earlier */
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
}


/* Extra code for the look of the demo */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem,1fr));
    gap: 1rem;
    margin: 1rem;
}
.demo-card {
    background-color: #E2E8F0;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
}
.demo-img {
    align-self: center;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
}
.demo-title {
    font-size: 1.5rem;
    margin: 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console