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.


  <div class="wrapper">
    <article class="flow">
      <h1>Extrinsic sizing vs intrinsic sizing</h1>
      <figure class="callout">
        <p>Toggle intrinsic sizing on and off to see how you can gain more control with <strong>extrinsic sizing</strong> and let the content have more control with <strong>intrinsic sizing</strong>. </p>
        <p>To see the effect that intrinsic and extrinsic sizing has, go ahead and add a few sentences of content to the card to see the vast differences in display.</p>
      <label class="toggle" for="intrinsic-switch">
        <span class="toggle__label">Turn on intrinsic sizing</span>
        <input type="checkbox" role="switch" class="toggle__element" id="intrinsic-switch" />
        <div class="toggle__decor" aria-hidden="true">
          <div class="toggle__thumb"></div>
      <div class="box-layout">
        <div class="dimension-label" aria-live="polite" aria-label="Current box width">
          <span data-element="width-label"></span>
        <figure class="box-demo box" data-element="parent-box">
          <img src="" alt="A purple Petunia flower in close focus" />
          <figcaption contenteditable>
            You can edit this text to see how it changes the layout of our box,
            depending on intrinsic and extrinsic sizing.
        <div class="dimension-label" aria-live="polite" aria-label="Current box height" data-orientation="vertical">
          <span data-element="height-label"></span>


                .box-demo {
  width: 400px;
  height: 400px;

.box-demo[data-sizing="intrinsic"] {
  width: max-content;
  height: max-content;

.box-layout {
  display: grid;
  width: max-content;
  gap: 0.5rem;
  grid-template-columns: 1fr min-content;



                const parentBox = document.querySelector('[data-element="parent-box"]');
const heightLabel = document.querySelector('[data-element="height-label"]');
const widthLabel = document.querySelector('[data-element="width-label"]');
const intrinsicSwitch = document.querySelector("#intrinsic-switch");

// Update the size labels on resize
const observer = new ResizeObserver((observedItems) => {
  const { borderBoxSize } = observedItems[0];

  widthLabel.innerText = `${Math.round(borderBoxSize[0].inlineSize)}px`;
  heightLabel.innerText = `${Math.round(borderBoxSize[0].blockSize)}px`;


// Set sizing attribute based on switch
intrinsicSwitch.addEventListener("change", () => {
    intrinsicSwitch.checked ? "intrinsic" : "extrinsic"