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.


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.


                <div class="theme-select">
  <form onchange="changeTheme()">
    <input type="checkbox" name="theme" id="theme">
    <label for="theme">Dark Theme Active</label>
<div class="card-container">
  <h2 class="card-title">Example of light and dark theme with css</h2>
  <p class="card-description">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam blandit orci mollis lorem venenatis, quis malesuada lacus vehicula. Mauris at nulla quis tellus gravida pulvinar. Morbi sem nulla, lacinia vel mauris vel, dictum pellentesque purus.
Duis luctus tortor ut hendrerit suscipit. Aliquam sodales libero sit amet velit ornare fermentum. Donec aliquam elit vel libero sagittis fermentum. Donec lobortis sem lacus, non sodales dolor finibus nec. Mauris facilisis id mi lacinia interdum. In nec eros tellus.
<div class="author">
  <a href="" target="_blank" title=""> - Mehmet Sert</a>


                @import url(',400,500&display=swap&subset=latin-ext');

:root {
  height: 100%;
  --bg-color: #f9f9f9;
  --card-bg-color: #efeeee;
  --color-primary: #4a4a4a;
  --color-secondary: #505050;
  &[data-theme="dark"] {
    --bg-color: #383838;
    --card-bg-color: #2d2d2d;
    --color-primary: #f5ecec;
    --color-secondary: #bfbfbf;
body {
  padding: 0;
  margin: 0;
  background-color: var(--bg-color);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Roboto', sans-serif;

.theme-select {
  margin: 0 0 30px 0;
  width: 80%;
  label {
    color: var(--color-primary);

.card-container {
  width: 80%;
  background-color: var(--card-bg-color);
  padding: 20px;
  box-sizing: border-box;
  box-shadow: 0px 10px 30px 0px rgba(0, 0, 0, 0.1);
  .card-title {
    font-weight: 500;
    color: var(--color-primary);
  .card-description {
    color: var(--color-secondary);
    font-size: 14px;
    line-height: 1.6;
    font-weight: 400;
.author {
  margin-top: 40px;
  a {
    color: var(--color-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 100;


                function changeTheme() {
  let themeVal = document.querySelector('input[name="theme"]').checked ? 'dark' : 'light';
  document.documentElement.setAttribute('data-theme', themeVal);