Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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

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.

HTML

              
                <h1>font-size is <span id="h1"></span></h1>
<p>font-size is <span id="p"></span></p>
<p>フォントサイズは、ビューポート幅が指定したの範囲より狭い場合は最小値に、<br>範囲内ではビューポート幅に比例したサイズに、広い場合は最大値になります。</p>
              
            
!

CSS

              
                :root {
  --font-size: 100;
  --rF: calc(16 * var(--font-size)/100); /* root font size 16 */
  --minW: 375; /* viewport width at the minimum font size */
  --maxW: 1200; /* viewport width at the max font size */
}

.html {
  font-size: calc(var(--font-size) * 1%); /* 16px */
}

body {
  --minF: 0.875; /* minimum font size 14px */
  --maxF: 1; /* max font size 16px */
  font-size: clamp(var(--minF) * 1rem, var(--minF) * 1rem + (var(--maxF) - var(--minF))/(var(--maxW) - var(--minW)) * (100vw - var(--minW) * 1px) * var(--rF), var(--maxF) * 1rem);
}

h1 {
  --minF: 1.5; /* minimum font size 1.5rem 24px */
  --maxF: 3; /* max font size 3rem 48px */
  font-size: clamp(var(--minF) * 1rem, var(--minF) * 1rem + (var(--maxF) - var(--minF))/(var(--maxW) - var(--minW)) * (100vw - var(--minW) * 1px) * var(--rF), var(--maxF) * 1rem);
}

              
            
!

JS

              
                const h1Styles = getComputedStyle(document.querySelector('h1'));
const pStyles = getComputedStyle(document.querySelector('p'));

function getFontSize() {
	document.getElementById('h1').textContent = h1Styles.getPropertyValue('font-size') + '.';
  document.getElementById('p').textContent = pStyles.getPropertyValue('font-size') + '.';
}

getFontSize();
window.addEventListener('resize', getFontSize);
              
            
!
999px

Console