Pen Settings



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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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.


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.


                <input type="text" id="text" value="">


                @font-face {
  font-family: "Noto Sans Mono CJK JP";
  src: local("NotoSansMonoCJKjp-Regular"),
       local("Noto Sans Mono CJK JP Regular"),
       local("Noto Sans Mono CJK JP");
  font-display: swap;

@font-face {
  font-family: "Noto Sans Mono CJK JP Web";
  src: url("")              format("woff2"),
       url("")                         format("woff2"),
       url("")               format("woff"),
       url("")                          format("woff"),
       url("")                format("opentype"),
       url("")                           format("opentype"),
       url("") format("opentype"),
       url("")            format("opentype");
  font-display: swap;

#text {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: 0;
  border: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: #000;
  font-size: 16px;
  font-family: "Noto Sans Mono CJK JP", "Noto Sans Mono CJK JP Web", Osaka-mono, "MS Gothic", Menlo, Consolas, Courier, "Courier New", monospace, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
  text-align: center;
  line-height: 1;
  background: #fff;
  caret-color: #069;


                document.addEventListener('DOMContentLoaded', () => {
  const calcCharacterLength = text => text.split('').reduce((length, character) => {
    const charCode = character.charCodeAt();
    if(Number.isNaN(charCode)) return length;
    const isHalfWidthCharacter = (charCode >= 0x0 && charCode <= 0x7f);  // 半角文字 … 判定これで十分なのかな
    return length + (isHalfWidthCharacter ? 0.5 : 1);
  }, 0);
  const element = document.getElementById('text');
  const calcFontSize = () => {
    const windowWidth  = window.innerWidth;
    const windowHeight = window.innerHeight;
    // 入力された文字列から「文字の長さ」を算出する・半角1文字は 0.5・全角1文字は 1 で返す
    const textLength = calcCharacterLength(element.value);
    // 最低 16px・ウィンドウの高さまで文字サイズを広げるか、1行に収まる範囲でウィンドウ幅から文字サイズを算出する
    const fontSize = Math.max(Math.min(Math.floor(windowWidth / textLength), windowHeight), 16); = `${fontSize}px`;
  window.addEventListener('resize', calcFontSize);
  element.addEventListener('input', calcFontSize);