cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - 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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <article>
    <h1>Button component demo</h1>
    <p>These three examples demo the <a href="https://davatron5000.github.io/a11y-nutrition-cards/components/button">Accessiblity Nutrition Card</a> for a button component.</p>
    <hr />
    <h2>Standard button</h2>
    <button>A standard button</button>
    <hr />
    <h2>Button that uses <code>aria-label</code></h2>
    <button aria-label="This is the text a screen reader would read">The aria-label overrides this</button>
    <hr />
    <h2>Button that uses <code>aria-description</code></h2>
    <p id="desc">This paragraph describes the button below.</p>
    <button aria-described-by="desc">Described by "#desc"</button>
</article>
    

            
          
!
            
              button {
    display: inline-block;
    border: 5px solid #000000;
    padding: 1rem 2rem;
    margin: 0;
    text-decoration: none;
    background: #ffffff;
    color: #000000;
    font-family: 'Open Sans', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    text-align: center;
    transition: background 250ms ease-in-out, 
                transform 150ms ease;
    -webkit-appearance: none;
    -moz-appearance: none;
}

button:hover,
button:focus {
    background: #0066cc;
    color: white;
}

button:focus {
    outline: 2px solid #ffffff;
    outline-offset: -10px;
}

button:active {
    transform: scale(0.99);
}


/* Presentational styles */
html {
    height: 100%;    
}

body {
    min-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f3f3f3;
    font-family: 'Open Sans', sans-serif;
    padding: 1rem 1rem 3rem 1rem;
}

h1 {
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 0;
}

h2 {
    font-size: 2.4rem;
    line-height: 1.2;
}

h1, h2 {
    font-family: 'Open Sans Condensed', sans-serif;
}

hr {
    border: none;
    height: 5px;
    background: #000000;
    margin: 4rem 0;
}

hr + h2 {
    margin-top: 0;
}

code {
    color: #e84118;
}

a {
    color: #0066cc;
    text-decoration-skip-ink: auto;
}
            
          
!
            
              const buttons = document.querySelectorAll('button');

buttons.forEach(button => {
    button.addEventListener('click', evt => {
        alert('Attaching a click event to a button gets you ENTER and SPACE key support for free')
    });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console