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

Auto Save

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>
<!-- Titres via http://www.catipsum.com/ -->
              
            
!

CSS

              
                /* Par défaut, tronquons brutalement le texte */
.line-clamp {
    /* Attention au calcul de max-height, cela doit correspondre à n line-height */
    max-height: calc(2 * 1.15 * 1.5rem);
    overflow: hidden;
}

/* Pour les navigateurs capables, tronquons avec une ellipse */
/* Pour simuler le fonctionnement d'un navigateur sans le support, rajoutez un s à clamp sur la ligne suivante */
@supports (-webkit-line-clamp: 2) {
    .line-clamp {
        /* Enlevons le max-height artificiel */
        max-height: none;
        
        /* Ces trois propriétés sont nécessaires, ainsi que overflow: hidden définit plus tôt */
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
}


/* Code nécessaire pour le look de la démo */
.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