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

              
                <div class="controller">
  <input id="widthRange" type="range" min="100" max="300">
  <output id="widthOutput"></output>
</div>

<div id="wrapper" class="wrapper">
  <div class="Container clamp">
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Corporis blanditiis rem reiciendis pariatur accusamus a impedit dicta odit, unde praesentium dolorum facere eaque excepturi consectetur culpa, tempore vel aspernatur quisquam.
    (<code>clamp()</code>)
  </div>
  <div class="Container minmax">
    Doloremque at distinctio, sint non maiores adipisci, sequi modi quos dolores eligendi consectetur temporibus explicabo saepe dolor officia hic minus ducimus eius aliquam ea laudantium quas voluptatum earum ab. Velit.
    (<code>min()</code>, <code>max()</code>)
  </div>
  <div class="Container props">
    Possimus accusamus eaque nam eum quod ut aliquid, perspiciatis quaerat nesciunt officia a minus consectetur! Doloremque temporibus, aliquid, exercitationem odio ipsum, fugit molestiae dolor accusantium qui id eligendi totam corporis?
    (properties)
  </div>
  <div class="Container">
    Reprehenderit necessitatibus id modi sit alias! Incidunt, facilis odit eos pariatur cum excepturi, accusamus sint quaerat quas magnam iure illum dolorem, iusto assumenda adipisci? Debitis nam praesentium assumenda architecto maiores!
    (none)
  </div>
</div>
              
            
!

CSS

              
                .Container {
  box-sizing: border-box;
  background-color: #ffc9;
  margin-inline: auto;
  padding-inline: 16px;
  text-align: justify;
  
  &.clamp {
    width: clamp(150px, 100%, 200px);
  }
  
  &.minmax {
    width: max(150px, min(100%, 200px));
  }
  
  &.props {
    min-width: 150px;
    max-width: 200px;
    width: 100%;
  }
}

.controller {
  align-items: center;
  background-color: #fff;
  display: flex;
  gap: 16px;
  top: 0;
  position: sticky;
}

.wrapper {
  border: 1px solid gray;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

              
            
!

JS

              
                widthRange.oninput = () => {
  render();
}

render();

function render() {
  const width = `${widthRange.value}px`;
  wrapper.style.width = width;
  widthOutput.textContent = width;
}
              
            
!
999px

Console