Pen Settings



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


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


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.


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.


    <div id="popup">
        <div id="popup__close-btn">&times;</div>
        <h1>Lorem ipsum dolor sit amet</h1>
        <h1>Lorem ipsum</h1>
        <p>Nullam lorem ante, gravida id tempor id, ultricies egestas velit. Vestibulum nec pellentesque justo. Praesent ante nisi, suscipit eu tellus eget, vestibulum venenatis quam. Aliquam magna sem, facilisis eget dui id, fringilla congue lacus. Maecenas finibus neque ut metus lobortis, non tristique nunc scelerisque.</p>



                section {
    position: relative;
    z-index: 0;
    width: 100vw;
    min-height: 100vh;
    padding: 32px;
article {
    width: 650px;
    margin: 0 auto;
    background: #f5f5f5;

#popup {
    display: none;
    position: fixed;
    z-index: 1;
    top: -50%;
    left: -50%;
    bottom: -50%;
    right: -50%;
    margin: auto;
    width: 300px;
    height: 300px;
    background-color: #ffffff;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.5);
} {
    display: block;



                // Popup modal with Vanilla JS

// define popup element...
var popupModal = document.getElementById("popup");
// ... and popup close button inside popupModal
var popupModalCloseBtn = popupModal.querySelector("#popup__close-btn");

// executing openModal() function when DOM is loaded
document.addEventListener("mouseleave", (event) => {
    if (
        event.clientY <= 0 ||
        event.clientX <= 0 ||
        event.clientX >= window.innerWidth ||
        event.clientY >= window.innerHeight
    ) {

// Define openModal function
function openModal() {
    // if popupModal exists ...
    if (popupModal) {
        // ... get a session storage cookie and define visibility ...
        let sessionModalCookie = sessionStorage.getItem("modal_closed");
        if (sessionModalCookie) {
        } else {
        if (popupModal) {
            //  ... and add a click event listener for close it
            document.addEventListener("click", function (e) {
                if ( == popupModalCloseBtn) {
                    sessionStorage.setItem("modal_closed", "true");