Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <body>
  <div class="container">
    <h1>
      With Param
    </h1>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse vitae laoreet urna. Aliquam faucibus eros eu purus viverra rhoncus. In ut enim eu dolor lobortis tristique sit amet et odio. Duis mattis augue quis magna porta laoreet. Sed at libero eget est posuere porta. Phasellus vel lacus mollis, fringilla erat sit amet, ornare lectus. Ut eu dolor mi. Aliquam placerat erat eget eros porttitor elementum. Mauris in lacus efficitur, sollicitudin diam ut, dignissim purus. Nullam mattis gravida orci, non luctus libero tincidunt ac. Vivamus ac elementum augue. Cras lorem elit, ultrices non orci id, posuere mollis nunc. In hac habitasse platea dictumst. Sed malesuada velit dapibus elit pretium pretium.
    </p>
    <h1 class="check">
      No param
    </h1>
    <p class="check">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse vitae laoreet urna. Aliquam faucibus eros eu purus viverra rhoncus. In ut enim eu dolor lobortis tristique sit amet et odio. Duis mattis augue quis magna porta laoreet. Sed at libero eget est posuere porta. Phasellus vel lacus mollis, fringilla erat sit amet, ornare lectus. Ut eu dolor mi. Aliquam placerat erat eget eros porttitor elementum. Mauris in lacus efficitur, sollicitudin diam ut, dignissim purus. Nullam mattis gravida orci, non luctus libero tincidunt ac. Vivamus ac elementum augue. Cras lorem elit, ultrices non orci id, posuere mollis nunc. In hac habitasse platea dictumst. Sed malesuada velit dapibus elit pretium pretium.
    </p>
  </div>
  <div id="dark-button">
    Dark mode
  </div>
  <script src="https://library.prototypo.io/ptypo.js"></script>
</body>
              
            
!

CSS

              
                * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #333;
}

body {
  display:flex;
  justify-content: center
}

.container {
  width: 70%;
}

h1 {
  font-size: 100px;
  margin:0.2em 0;
  font-family: 'titleFont';
  font-weight: normal;
  transition: color .3s ease, background-color .3s ease;
}

h1.check {
  font-family: 'titleFont2';
}

p {
  font-size: 18px;
  line-height: 24px;
  font-family: 'paragraphFont';
  transition: color .3s ease, background-color .3s ease;
}

p.check {
  font-family: 'paragraphFont2';
}

#dark-button {
  position:fixed;
  bottom: 30px;
  left: 30px;
  background-color: #24d390;
  font-family: sans-serif;
  color: #fefefe;
  padding: 20px;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
}

#dark-button:hover {
  background-color: #19c085;
}

body.dark {
  background-color: #3b3b3b;
  
  h1, p {
    color: #fefefe;
    font-weight: normal;
  }
}
              
            
!

JS

              
                //Try the library here https://app.prototypo.io
const ptypoFactory = new Ptypo.default();
const fontToggles = [];

ptypoFactory.createFont(
  'titleFont',
  Ptypo.templateNames.ELZEVIR).then(function(font) {
    //Setting up the right parameters
    font.changeParam('thickness', 110);
    
    //Storing the function that will be used to change from light to dark
    //and vice versa
    fontToggles.push({
      lightMode: function() {
        font.changeParam('thickness', 110);
      },
      darkMode: function() {
        font.changeParam('thickness', 107);
      },
    });
});

ptypoFactory.createFont(
  'paragraphFont',
  Ptypo.templateNames.GROTESK).then(function(font) {
    font.changeParams({thickness: 70, spacing: 0.5});
  
    fontToggles.push({
      lightMode: function() {
        font.changeParam('thickness', 70);
      },
      darkMode: function() {
        font.changeParam('thickness', 50);
      },
    });
});

//We create two control fonts to see how they compare to the transformed font
ptypoFactory.createFont('paragraphFont2', Ptypo.templateNames.GROTESK).then(function(font) {
  font.changeParams({thickness: 70, spacing: 0.5});
});
ptypoFactory.createFont('titleFont2', Ptypo.templateNames.ELZEVIR).then(function(font) {
  font.changeParams({thickness: 110, width: 1.15});
});

let button = document.getElementById('dark-button');

button.addEventListener('click', function(e) {
  document.body.classList.toggle('dark');
  
  fontToggles.forEach(function(toggle) {
    toggle[document.body.classList.contains('dark')
           ? 'darkMode'
           : 'lightMode']();
  });
})


              
            
!
999px

Console