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


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


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.


  <header aria-label="Site header" id="header" role="banner">
    <div class="container">
      <div class="header">
        <h1>My site</h1>
        <div class="switch-wrapper">
          <label class="switch" for="checkbox">
            <input type="checkbox" id="checkbox"/>
            <div class="slider round"></div>

  <div class="container">
    <section class="main" id="main">
      <main aria-label="Site main content" class="content" id="content" role="main">
       <p>Illo eligendi quam laboris placeat vestibulum. Accusantium mus? Nemo, sociosqu? Felis diamlorem, a parturient aenean etiam, donec animi, fames voluptatum porttitor feugiat sociosqu facere! Cillum, non, repudiandae ex, dis tincidunt condimentum officia natus possimus. Pretium ea veritatis at mattis. Nisi mi dolorem! Wisi varius? Sollicitudin, eos vivamus lacinia. Adipisci totam.</p>




                @import url(";500&display=swap");

/*  Variable decleration for normal/light mode */
:root {
  --color-background: #f0f0f0;
  --color-header: rgb(14, 33, 141);
  --color-header-text: #aecafa;
  --color-text: #2c0000;
  --color-card-bg: #fff;
  --color-link: rgb(255, 0, 0);

/* Variable decleration for dark mode */

[data-theme="dark"] {
  --color-background: #1a1a1a;
  --color-header: #aecafa;
  --color-header-text: 0e218d;
  --color-text: #d3d3d3;
  --color-card-bg: #435561;
  --color-link: #24ce24;

body {
  background: var(--color-background);
  font-family: "Poppins", sans-serif;

.container {
  width: 900px;
  max-width: 1280px;
  margin: auto;
  padding:0 30px;

a {
  color: var(--color-link);

.node__submitted {
  color: var(--color-text);

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  background-color: var(--color-header);

.header a,
  color: var(--color-header-text);
  text-decoration: none;
  font-weight: bold;

.region-navigation {
  display: flex;
  justify-content: center;
} {
  display: flex;
  justify-content: center;
} li {
  margin-right: 30px;

.switch-wrapper {
  display: flex;
  align-items: center;

.switch {
  display: inline-block;
  height: 34px;
  position: relative;
  width: 60px;

.switch input {
  display: none;

.slider {
  background-color: white;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: 0.4s;

.slider:before {
  background-color: rgb(255, 196, 0);
  bottom: 4px;
  content: url("sunny-day.svg");
  height: 26px;
  left: 4px;
  position: absolute;
  transition: 0.4s;
  width: 26px;

input:checked + .slider {
  background-color: rgb(36, 36, 36);

input:checked + .slider:before {
  transform: translateX(26px);
  content: url("night.svg");
  background-color: rgb(59, 116, 223);

.slider.round {
  border-radius: 34px;

.slider.round:before {
  border-radius: 50%;

.site-logo img {
  width: 100px;

.header.region {
  padding: 5px;

.header.region-branding {
  flex: 0 1 5%;

.region-branding {
  display: flex;
  align-items: center;

.header.region-navigation {
  flex: 0 1 80%;

.header.region-search {
  flex: 0 1 15%;

.region.block-region {
  padding: 15px;

.featured {
  padding: 40px 20px;

.main {
  padding: 50px 0;
  display: flex;
  justify-content: space-between;

.main.content {
  flex: 0 1 65%;



                const toggleSwitch = document.querySelector(
        '.switch input[type="checkbox"]'
      const currentTheme = localStorage.getItem("theme");

      if (currentTheme) {
        document.documentElement.setAttribute("data-theme", currentTheme);

        if (currentTheme === "dark") {
          toggleSwitch.checked = true;

      function switchTheme(e) {
        if ( {
          document.documentElement.setAttribute("data-theme", "dark");
          localStorage.setItem("theme", "dark");
        } else {
          document.documentElement.setAttribute("data-theme", "light");
          localStorage.setItem("theme", "light");

      toggleSwitch.addEventListener("change", switchTheme, false);