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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                	<header>
    <div class="container">
     <h1>HTML Ipsum Presents</h1>
      <p class="header-description">
        hogehoge
      </p>
    </div>
  </header>
  <main>
    <div class="container">
      <section id="example">
    

<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>

<h2>Header Level 2</h2>

<ol>
   <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
   <li>Aliquam tincidunt mauris eu risus.</li>
</ol>

<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>

<h3>Header Level 3</h3>

<ul>
   <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
   <li>Aliquam tincidunt mauris eu risus.</li>
</ul>

<pre><code>
#header h1 a {
  display: block;
  width: 300px;
  height: 80px;
}
</code></pre>
<ul>
   <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
   <li>Aliquam tincidunt mauris eu risus.</li>
   <li>Vestibulum auctor dapibus neque.</li>
</ul>
         <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p><ul>
   <li>Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.</li>
   <li>Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus.</li>
   <li>Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.</li>
   <li>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</li>
</ul>
            <form action="#" method="post">
    <div>
         <label for="name">Text Input:</label>
         <input type="text" name="name" id="name" value="" tabindex="1" />
    </div>

    <div>
         <h4>Radio Button Choice</h4>

         <label for="radio-choice-1">Choice 1</label>
         <input type="radio" name="radio-choice-1" id="radio-choice-1" tabindex="2" value="choice-1" />

     <label for="radio-choice-2">Choice 2</label>
         <input type="radio" name="radio-choice-2" id="radio-choice-2" tabindex="3" value="choice-2" />
    </div>

  <div>
    <label for="select-choice">Select Dropdown Choice:</label>
    <select name="select-choice" id="select-choice">
      <option value="Choice 1">Choice 1</option>
      <option value="Choice 2">Choice 2</option>
      <option value="Choice 3">Choice 3</option>
    </select>
  </div>

  <div>
    <label for="textarea">Textarea:</label>
    <textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
  </div>

  <div>
      <label for="checkbox">Checkbox:</label>
    <input type="checkbox" name="checkbox" id="checkbox" />
    </div>

  <div>
      <input type="submit" value="Submit" />
    </div>
</form>
  <button id="mode-toggler" class="btn">
    Turn on Javascript 🌓
  </button>
              
            
!

CSS

              
                
*,
*:before,
*:after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-size: 18px;
    width: 100vw;
    line-height: 1.55;

}

header {
    padding-top: 60px;
    padding-bottom: 30px;
}

h1 {
    margin: 0;
    font-size: 64px;
    line-height: 1;
}

h2 {
    display: inline-block;
    position: relative;
    margin: 0 0 20px 0;
    font-size: 32px;
    line-height: 1;
}

h2:before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    height: 6px;
    width: 72px;
    background-color: #3bc4fb;
    z-index: -1;
}

h3 {
    margin: 0;
    font-size: 20px;
}

main p {
    margin: 0 0 15px 0;
    max-width: 640px;
}

.header-description {
    margin: 20px 0 0 0;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: .5px;
    font-style: italic;
}

main {
    padding-top: 100px;
}

section {
    padding-bottom: 100px;
    margin-bottom: -30px;
}

footer {
    padding-top: 15px;
    padding-bottom: 15px;
}

.footer-copyright {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.footer-copyright a {
    color: inherit;
}

#mode-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    font-size: 22px;
    padding: 15px 30px;
    border-radius: 50px;
    letter-spacing: .5px;
    font-weight: 700;
    border: 0;
}

.btn {
    display: inline-block;
    cursor: pointer;
    padding: 8px 16px;
    border: 2px solid #3bc4fb;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    background-color: transparent;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    background-color: #3bc4fb;
    transition: all .15s ease;
}

.btn:hover {
    background-color: #3bc4fb;
}

.btn:focus {
    outline: none;
}

.container {
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 830px;
}

pre {
    margin: 0 0 30px -9999px;
    padding: 30px 0 30px 9999px;
    -ms-overflow-style: scrollbar;
}

code {
    font-size: 14px;
    line-height: 1.8;
    display: block;
    overflow-x: auto;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.contacts-btns {
    padding: 0 0 30px 0;
    margin: -10px;
    display: flex;
    flex-flow: row wrap;
    align-items: center;
}

.contacts-btns > li {
    list-style: none;
    padding: 10px;
}

.contacts-reddit {
    font-style: italic;
    font-weight: 500;
    font-size: 14px;
}

.contacts-reddit > a {
    color: inherit;
}

@media(max-width: 767px) {
    body {
        font-size: 16px;
    }

    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 28px;
    }

    h3 {
        font-size: 18px;
    }

    #mode-toggler {
        font-size: 20px;
        padding: 10px 20px;
    }

    main {
        padding-top: 50px;
    }

    section {
        padding-bottom: 50px;
    }
}
              
            
!

JS

              
                ! function(e, t) {
    "function" == typeof define && define.amd ? define([], t("DarkMode")) : "object" == typeof exports ? module.exports = t("DarkMode") : e.DarkMode = t("DarkMode")
}(this, function(e) {
    "use strict";
    var t = {
        light: !1,
        dark: !1,
        startAt: "21:00",
        endAt: "06:00",
        checkSystemScheme: !0,
        saveOnToggle: !0
    }, o = function(e, o) {
        var r, i = {};
        for (r in t) Object.prototype.hasOwnProperty.call(t, r) && (i[r] = t[r]);
        for (r in o) Object.prototype.hasOwnProperty.call(o, r) && (i[r] = o[r]);
        return i
    }, r = document.getElementsByTagName("head")[0],
        i = document.getElementsByTagName("body")[0],
        n = function(e) {
            var t = new Date,
                o = e.split(":");
            return t.setHours(o[0], o[1], 0, 0)
        }, s = function(e) {
            return "light" === e ? "dark" : "light"
        };

    function d(e) {
        this.options = o(t, e), this.init()
    }
    return d.prototype = {
        init: function() {
            this.options.saveOnToggle || localStorage.removeItem("dm-mode");
            var e = this.getMode();
            if (this.options.checkSystemScheme && window.matchMedia) {
                var t = this;
                window.matchMedia("(prefers-color-scheme: dark)").addListener(function(e) {
                    return e.matches && t.setMode("dark")
                }), window.matchMedia("(prefers-color-scheme: light)").addListener(function(e) {
                    return e.matches && t.setMode("light")
                })
            }
            return this.setMode(e), !0
        },
        getMode: function() {
            if (this.mode) return this.mode;
            var e = localStorage.getItem("dm-mode");
            if (e) return e;
            if (this.options.checkSystemScheme) {
                var t = this.getSystemScheme();
                if ("auto" !== t) return this.mode = t, this.mode
            }
            var o = n(this.options.startAt),
                r = n(this.options.endAt),
                i = (new Date).getTime();
            return r < i && i > o ? "dark" : "light"
        },
        setMode: function(e) {
            if ("light" !== e && "dark" !== e) return console.error("setMode", "Invalid value"), !1;
            this.mode = e;
            var t, o, n, d = s(e);
            if (this.options[e]) {
                var a = document.getElementById("dm-" + e),
                    m = document.getElementById("dm-" + d);
                a ? a && a.removeAttribute("disabled") : (t = "dm-" + e, o = this.options[e], (n = document.createElement("link")).id = t, n.rel = "stylesheet", n.type = "text/css", n.href = o, r.getElementsByTagName("link")[0] ? r.insertBefore(n, r.getElementsByTagName("link")[0]) : r.appendChild(n)), m && m.setAttribute("disabled", !0)
            }
            return i.classList.add("dm-" + e), i.classList.remove("dm-" + d), !0
        },
        isModeSaved: function() {
            return Boolean(localStorage.getItem("dm-mode"))
        },
        clearSavedMode: function() {
            return localStorage.removeItem("dm-mode"), !0
        },
        toggleMode: function() {
            var e = s(this.mode);
            return this.setMode(e), this.options.saveOnToggle && localStorage.setItem("dm-mode", e), e
        },
        toggleTheme: function() {
            return this.toggleMode()
        },
        getSystemScheme: function() {
            if (window.matchMedia) {
                if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
                if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light"
            }
            return "auto"
        }
    }, d
});

		var DarkMode = new DarkMode({
			light: 'https://nickdeny.github.io/darkmode-js/light.css',
			dark: 'https://nickdeny.github.io/darkmode-js/dark.css',
    })
    
    var ModeToggler = document.getElementById('mode-toggler')
    changeTogglerText()

	  ModeToggler.onclick = function() {
      DarkMode.toggleMode()
      changeTogglerText()
    }
    
    function changeTogglerText() {
      var currentMode = DarkMode.getMode()
      ModeToggler.textContent = currentMode === 'light'  ? 'To dark 🌝' : 'To light 🌚'
    }
              
            
!
999px

Console