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.


                <!-- Container -->
<div class="container" data-theme="dark">
  <div class="inner-wrapper">
    <!-- Controller Row -->
    <div class="controller-row">
      <label class="switch">
        <input id="toggler" type="checkbox">
        <span class="slider round"></span>
    </div><!-- End of controller row -->
    <!-- Card -->
    <div class="card">
      <div class="card__header">
        <h2 class="__title">Card Title</h2>
      <div class="card__body">
        <p class="__detail">
          Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
    </div><!-- End of card -->
</div><!-- End of container-->


                @import url(';500;600;700&display=swap" rel="stylesheet');

/*** Light Mode Theme ***/
:root, [data-theme="default"] {
  --body-bg-color: #fff;
  --card-bg-color: #fff;
  --box-shadow-color: rgba(0,0,0,0.2);
  --text-color: #333;
  --switch-on-color: #444352;
  --switch-off-color: #ccc;
  --toggler-color: #fff;
/* Dark Mode Theme */
[data-theme="dark"] {
  --body-bg-color: #444352;
  --card-bg-color: #545363;
  --box-shadow-color: rgb(18, 18, 19, 0.2);
  --text-color: #efefef;
  --toggler-color: #444352;
  --switch-on-color: #fff;
  --switch-off-color: #ccc;

* {
  font-family: 'Poppins', sans-serif;
  color: var(--text-color);
  transition: color .45s ease-in;

body {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  margin: 0;

.container {
  height: 100vh;
  width: 100vw;
  display: flex;
  background-color: var(--body-bg-color);
  transition: background-color .45s ease-in;

.inner-wrapper {
  width: 500px;
  margin: auto;

.controller-row {
  text-align: right;

/*** Card ***/
.card {
  margin: auto;
  width: 300px;
  padding: 10px 15px;
  box-shadow: 2px 3px 4px 1px var(--box-shadow-color);
  box-shadow-color: var(--box-shadow-color);
  background-color: var(--card-bg-color);
  transition: background-color .45s ease-in,
              box-shadow-color .45s ease-in;
.card__body {
  padding: 0 10px;
.__title {
  font-size: 20px;
  font-weight: 600;
.__detail {
  font-size: 18px;

* Toggle switch credit from W3School
/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 20px;
/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--switch-off-color);
  -webkit-transition: .4s;
  transition: .4s;
.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 4px;
  bottom: 4px;
  background-color: var(--toggler-color);
  -webkit-transition: .4s;
  transition: .4s;
input:checked + .slider {
  background-color: var(--switch-on-color);
input:focus + .slider {
  box-shadow: 0 0 1px var(--switch-on-color);
input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
/* Rounded sliders */
.slider.round {
  border-radius: 20px;
.slider.round:before {
  border-radius: 50%;



                // On toggler clicked

var container = document.getElementsByClassName('container')[0];
document.getElementById('toggler').addEventListener('change', (event) => {
  console.log(toggler) ? container.removeAttribute('data-theme') : container.setAttribute('data-theme', 'dark');