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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <h1>英語 + 和英混在 Serif フォントのテスト</h1>
<p>Author : <a href="">Neo</a></p>
<div id="wrapper"></div>
              *, ::before, ::after { box-sizing: border-box; }
html { overflow-y: scroll; -webkit-text-size-adjust: 100%; }
body { margin: 1rem; line-height: 1.7; }
html, body { font-size: 14px; font-family: "游ゴシック体", YuGothic, "Yu Gothic M", "游ゴシック Medium", "Yu Gothic Medium", sans-serif; }
h1, h2, h3, h4, h5, h6, p, hr, dl, dt, dd, ol, l, pre, table { margin-top: 0; margin-bottom: 1rem; }
@font-face { font-family: "Yu Gothic M"; src: local("Yu Gothic Medium"); }
@font-face { font-family: "Yu Gothic M"; src: local("Yu Gothic Bold"); font-weight: bold; }

.example { position: relative; margin-left: 80px; padding-left: 1rem; width: calc(50% - 80px); }
.example .checkbox { position: absolute; }
.example .title { font-size: 1.05rem; font-weight: bold; }
.overlay { position: fixed; top: 1rem; left: 50%; }
              function createCss(id, css) {
  return `#${id} { font-family: ${css}, "游ゴシック体", YuGothic, "Yu Gothic M", "游ゴシック Medium", "Yu Gothic Medium", sans-serif; }`;
function createHtml(id, title, checkboxOffsetX, checkboxOffsetY) {
  return `
    <div class="example" id="${id}">
      <input type="checkbox" class="checkbox" style="top: ${checkboxOffsetY}px; left: ${checkboxOffsetX}px;">
      <div class="title">${title}</div>
      <div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit,<br>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.<br>lorem ipsum (ロレム・イプサム、略してリプサム lipsum ともいう) とは、<br>出版、Web デザイン、Graphic デザインなどの諸分野において使用されているテキスト。<br>書籍やウェブページや広告などのデザインのプロトタイプを制作したり顧客に<br>プレゼンテーションしたりする際に、視覚的なデザインを調整したりわかりやすく見せる。</div>
function toggle(id) {

const enFonts = [
  { title: 'Georgia'        , name: 'g', css: 'Georgia' },
  { title: 'Times'          , name: 'n', css: 'Times'   },
  { title: 'Times New Roman', name: 'h', css: '"Times New Roman"' }
const jaFonts = [
  { title: 'YuMincho'   , name: 'y', css: '"游明朝体", YuMincho, "游明朝", "Yu Mincho"' },
  { title: 'Hiragino'   , name: 'h', css: '"ヒラギノ明朝 ProN W3", "Hiragino Mincho ProN W3", HiraMinProN-W3, "ヒラギノ明朝 ProN", "Hiragino Mincho ProN", "ヒラギノ明朝 Pro", "Hiragino Mincho Pro"' },
  { title: 'HGS Mincho' , name: 'g', css: '"HGS明朝E"' },
  { title: 'MS P Mincho', name: 'p', css: '"MS P明朝", "MS PMincho"' }

document.addEventListener('DOMContentLoaded', () => {
  const wrapper = document.getElementById('wrapper');
  let style = '<style>';
  const checkboxSize = 20;
  const negativeOffset = enFonts.length * -checkboxSize;
  jaFonts.forEach((jaFont, indexY) => {
    const offsetY = indexY * checkboxSize;
    // 和英混在フォントのみ出力
    const jaOnlyId = `f${}`;
    style += createCss(jaOnlyId, jaFont.css);
    const jaOnlyOffsetX = negativeOffset - checkboxSize;
    const jaOnlyHtml = createHtml(jaOnlyId, jaFont.title, jaOnlyOffsetX, offsetY);
    wrapper.insertAdjacentHTML('beforeend', jaOnlyHtml);
    document.querySelector(`#${jaOnlyId} input`).addEventListener('click', () => { toggle(jaOnlyId); });
    // 英字フォントを手前に配置したバリエーション
    enFonts.forEach((enFont, indexX) => {
      const id = `f${}${}`;
      style += createCss(id, `${enFont.css}, ${jaFont.css}`);
      const offsetX = negativeOffset + indexX * checkboxSize;
      const html = createHtml(id, `${enFont.title} + ${jaFont.title}`, offsetX, offsetY);
      wrapper.insertAdjacentHTML('beforeend', html);
      document.querySelector(`#${id} input`).addEventListener('click', () => { toggle(id); });
  style += '</style>';
  wrapper.insertAdjacentHTML('beforebegin', style);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.