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="center">
    <label>Simulate user's different default font size</label>
    <input type=number value=16 />
  </div>
  <div class="rectangle">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a mauris mi. Donec ultricies ligula vitae magna mollis, a varius libero placerat. Phasellus pretium et lacus quis imperdiet. Phasellus dignissim eu nisi a cursus. Proin tristique ac leo sit amet aliquam. Vestibulum varius vestibulum enim eget facilisis. Mauris nec tellus ac augue porta imperdiet iaculis eget risus. Etiam vitae mollis odio, et mattis ligula. Maecenas tellus tortor, laoreet in arcu non, fermentum tristique dolor. In hac habitasse platea dictumst. Ut ipsum turpis, dignissim id pellentesque et, consectetur a odio. Nam porttitor malesuada urna, vitae aliquet nisi fermentum vitae. Vivamus dignissim condimentum augue quis lobortis. Integer dapibus orci sed libero efficitur tempor.</p>
  </div>
</body>
              
            
!

CSS

              
                *{
  margin: 0;
  box-sizing: border-box
}

html{
  font-size: 16px;
}

body{
  background-color: hsl(30, 50%, 50%)
}

body > *{
  margin-bottom: 7vh;
  border: 1px solid black;
}

body > div{
  background-color: hsl(30, 70%, 30%);
  padding-block: 3vh
}

body > div.rectangle p{
  padding-inline: 1em;
  
  font-size: 1rem;
  line-height: 20px;
}

.center{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

body > div input,
label{
  font-size: 1rem
}

body > div input{
  width: 4.5em;
  padding-left: 1em
}

@media (max-width: 700px){
  label{
    font-size: .75rem
  }
}
              
            
!

JS

              
                const html = document.querySelector("html");
const input = document.querySelector("input");

input.addEventListener("change", (e) => {
    const tamanho = e.target.value;
    html.style.setProperty("font-size", `${tamanho}px`);
    
  
  }
);
              
            
!
999px

Console