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 class="theme-switch-wrapper">
  <label class="theme-switch" for="checkbox">
    <input type="checkbox" id="checkbox" />
    <div class="slider round"></div>

  <article class="post">
    <h1>Lorem Ipsum</h1>
    <p class="post-meta">Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci

    <p><strong>Lorem ipsum</strong> dolor sit amet consectetur, adipisicing elit. Suscipit voluptatum repellat
      praesentium impedit,
      earum cumque recusandae asperiores? <strong>Ullam</strong>, qui at. Ex aliquam ratione suscipit. Soluta
      voluptate consectetur quae est! Veniam.</p>

    <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Deleniti, architecto. Ducimus molestiae officia dolor
      voluptatem at, sequi debitis odit placeat rerum nisi quidem laudantium nobis in accusamus aut culpa obcaecati!
      Lorem ipsum dolor, <strong>sit amet consectetur</strong> adipisicing elit. Cupiditate provident, aliquid
      mollitia vero quisquam
      eligendi enim, eum incidunt dolorem ipsa voluptatem pariatur cum quis, repellat fugiat. In illo necessitatibus
    <a href="#">Czytaj więcej</a>


                @import url(",400italic,700|Sansita+One");

:root {
  --primary-color: #24242b;
  --secondary-color: #433055;
  --font-color: #3f3f3f;
  --bg-color: #f3f3f3;
  --heading-color: #2a2a23;

html[data-theme="dark"] {
  --primary-color: #f89898;
  --secondary-color: #8894b3;
  --font-color: #d8d8f6;
  --bg-color: #242424;
  --heading-color: #818cab;

body {
  font-family: "Lato", sans-serif;
  background-color: var(--bg-color);
  color: var(--font-color);
  max-width: 900px;
  margin: 0 auto;
  padding: 0 30px;
  font-size: calc(1rem + 0.25vh);

h1 {
  color: var(--heading-color);
  font-family: "Lato", serif;
  font-size: 3rem;
  margin-bottom: 1vh;

p {
  font-size: 1.1rem;
  line-height: 1.6rem;

a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  padding-bottom: 5px;
  transition: border-bottom 1s;
  font-weight: bold;

  &:focus {
    border-bottom: 3px solid currentColor;

section {
  margin: 0 auto;

.post-meta {
  font-size: 1rem;
  font-style: italic;
  display: block;
  margin-bottom: 4vh;
  color: var(--secondary-color);

nav {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0;

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

  input {
    display: none;

  &-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;

    em {
      margin-left: 10px;
      font-size: 1rem;

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

  &:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 26px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 26px;

  &.round {
    border-radius: 34px;

    &:before {
      border-radius: 50%;

input:checked {
  & + .slider {
    background-color: #66bb6a;

    &:before {
      transform: translateX(26px);



                const toggleSwitch = document.querySelector(
  '.theme-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(event) {
  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);