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

              
                <button class="button">
    <div class="icon">
        <svg class="top">
            <use xlink:href="#top">
        </svg>
        <svg class="bottom">
            <use xlink:href="#bottom">
        </svg>
    </div>
    <div class="text">Delete</div>
</button>

<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
    <symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="top">
        <path d="M15,3.75 C15.5522847,3.75 16,4.19771525 16,4.75 L16,5.75 L18.25,5.75 C18.6642136,5.75 19,6.08578644 19,6.5 C19,6.91421356 18.6642136,7.25 18.25,7.25 L5.75,7.25 C5.33578644,7.25 5,6.91421356 5,6.5 C5,6.08578644 5.33578644,5.75 5.75,5.75 L8,5.75 L8,4.75 C8,4.19771525 8.44771525,3.75 9,3.75 L15,3.75 Z M14,5 L10,5 C9.72385763,5 9.5,5.22385763 9.5,5.5 C9.5,5.74545989 9.67687516,5.94960837 9.91012437,5.99194433 L10,6 L14,6 C14.2761424,6 14.5,5.77614237 14.5,5.5 C14.5,5.25454011 14.3231248,5.05039163 14.0898756,5.00805567 L14,5 Z"></path>
    </symbol>
    <symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" id="bottom">
        <path d="M7.02498527,8.25 L16.9751371,8.25 C17.5411532,8.25 18,8.69771525 18,9.25 C18,9.2951932 17.9968602,9.34033442 17.9906022,9.3851132 L16.6878729,18.7066989 C16.6389095,19.0569074 16.4041276,19.3558931 16.0703039,19.4931212 C14.8428392,19.9977071 13.4860916,20.25 12.0000612,20.25 C10.5140229,20.25 9.1572688,19.9977044 7.92979891,19.4931132 C7.59597391,19.3558774 7.36118974,19.0568881 7.31224574,18.7066728 L6.00952014,9.3851132 C5.93304388,8.83789281 6.32568685,8.33379079 6.88651275,8.25916983 C6.93240487,8.25306363 6.97866843,8.25 7.02498527,8.25 Z"></path>
    </symbol>
</svg>
        
<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/ai" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_blank" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
              
            
!

CSS

              
                .button {
    --background: #275EFE;
    --background-hover: #1D4FE1;
    --text: #fff;
    --icon: #fff;
    display: flex;
    outline: none;
    cursor: pointer;
    border: 0;
    padding: 9px 20px 9px 12px;
    border-radius: 11px;
    line-height: 24px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
    color: var(--text);
    background: var(--b, var(--background));
    transition: transform .3s, background .4s;
    transform: scale(var(--scale, 1)) translateZ(0);
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    &:active {
        --scale: .95;
    }
    &:hover {
        --b: var(--background-hover);
    }
    .icon,
    .text {
        display: inline-block;
        vertical-align: top;
        transform: translateZ(0);
    }
    .icon {
        width: 24px;
        height: 24px;
        position: relative;
        z-index: 1;
        margin-right: 8px;
        color: var(--text);
        svg {
            width: 96px;
            height: 96px;
            display: block;
            position: absolute;
            left: -36px;
            top: -36px;
            will-change: transform;
            fill: var(--icon);
            transform: scale(.25) translateZ(0);
            animation: var(--name, var(--name-top, none)) 2400ms ease forwards;
            &.bottom {
                --name: var(--name-bottom, none);
            }
        }
    }
    .text {
        animation: var(--name-text, none) 2400ms ease forwards;
        span {
            display: inline-block;
            vertical-align: top;
            opacity: var(--span-o, 1);
            transform: translate(var(--span-x, 0), var(--span-y, 0)) rotate(var(--span-r, 0deg)) translateZ(0);
            transition: transform .3s ease var(--span-d, 0s), opacity .2s linear var(--span-o-d, .3s);
            $i: 1;
            @while $i < 12 {
                &:nth-child(#{$i}) {
                    --span-delay: #{$i / 20 + .35 + s};
                    --span-o-d: #{$i / 40 + .3 + s};
                }
                $i: $i + 1;
            }
        }
    }
    &.delete {
        --name-top: trash-top;
        --name-bottom: trash-bottom;
        --name-text: text;
        --span-x: -8px;
        --span-y: 8px;
        --span-r: -40deg;
        --span-o: 0;
        .text {
            span {
                --span-o-d: 1s;
                --span-d: var(--span-delay);
            }
        }
    }
}

@keyframes trash-bottom {
    25%,
    32% {
        transform: translate(32px, 19px) scale(1) translateZ(0);
    }
    70%,
    80% {
        transform: translate(32px, 0) scale(.25) translateZ(0);
    }
    90% {
        transform: translateX(-2px) scale(.25) translateZ(0);
    }
    100% {
        transform: scale(.25) translateZ(0);
    }
}

@keyframes trash-top {
    25%,
    32% {
        transform: translate(38px, 4px) scale(1) rotate(-20deg) translateZ(0);
    }
    70%,
    80% {
        transform: translate(32px, 0) scale(.25) translateZ(0);
    }
    90% {
        transform: translateX(-2px) scale(.25) translateZ(0);
    }
    100% {
        transform: scale(.25) translateZ(0);
    }
}

@keyframes text {
    25% {
        transform: translate(-4px, -6px) rotate(-20deg) translateZ(0);
    }
    70% {
        opacity: 1;
        transform: translate(-12px, 48px) rotate(-80deg) scale(.2) translateZ(0);
    }
    71% {
        opacity: 0;
    }
    72%,
    90% {
        opacity: 0;
        transform: translateZ(0);

    }
    100% {
        opacity: 1;
    }
}

html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: inherit;
    &:before,
    &:after {
        box-sizing: inherit;
    }
}

// Center & dribbble
body {
    min-height: 100vh;
    display: flex;
    font-family: 'Inter', Arial;
    justify-content: center;
    align-items: center;
    background: #F6F8FF;
    .dribbble {
        position: fixed;
        display: block;
        right: 20px;
        bottom: 20px;
        img {
            display: block;
            height: 28px;
        }
    }
    .twitter {
        position: fixed;
        display: block;
        right: 64px;
        bottom: 14px;
        svg {
            width: 32px;
            height: 32px;
            fill: #1da1f2;
        }
    }
}
              
            
!

JS

              
                document.querySelectorAll('.button').forEach(button => {
    let text = button.querySelector('.text');
    text.innerHTML = '<span>' + text.textContent.trim().split('').join('</span><span>') + '</span>';
    button.addEventListener('click', e => {
        if(!button.classList.contains('delete')) {

            button.classList.add('delete');

            setTimeout(() => button.classList.remove('delete'), 2400);

        }
        e.preventDefault();
    });
});

              
            
!
999px

Console