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.


                <h2>ul &gt; li &gt; a</h2>
<ul id="gridmap-list" class="gridmap">
  <li class="pref hokkaido"><a href="#">北海道</a></li>
  <li class="pref tohoku"><a href="#">青森</a></li>
  <li class="pref tohoku"><a href="#">岩手</a></li>
  <li class="pref tohoku"><a href="#">宮城</a></li>
  <li class="pref tohoku"><a href="#">秋田</a></li>
  <li class="pref tohoku"><a href="#">山形</a></li>
  <li class="pref tohoku"><a href="#">福島</a></li>
  <li class="pref kanto"><a href="#">茨城</a></li>
  <li class="pref kanto"><a href="#">栃木</a></li>
  <li class="pref kanto"><a href="#">群馬</a></li>
  <li class="pref kanto"><a href="#">埼玉</a></li>
  <li class="pref kanto"><a href="#">千葉</a></li>
  <li class="pref kanto"><a href="#">東京</a></li>
  <li class="pref kanto"><a href="#">神奈川</a></li>
  <li class="pref chubu"><a href="#">新潟</a></li>
  <li class="pref chubu"><a href="#">富山</a></li>
  <li class="pref chubu"><a href="#">石川</a></li>
  <li class="pref chubu"><a href="#">福井</a></li>
  <li class="pref chubu"><a href="#">山梨</a></li>
  <li class="pref chubu"><a href="#">長野</a></li>
  <li class="pref chubu"><a href="#">岐阜</a></li>
  <li class="pref chubu"><a href="#">静岡</a></li>
  <li class="pref chubu"><a href="#">愛知</a></li>
  <li class="pref kinki"><a href="#">三重</a></li>
  <li class="pref kinki"><a href="#">滋賀</a></li>
  <li class="pref kinki"><a href="#">京都</a></li>
  <li class="pref kinki"><a href="#">大阪</a></li>
  <li class="pref kinki"><a href="#">兵庫</a></li>
  <li class="pref kinki"><a href="#">奈良</a></li>
  <li class="pref kinki"><a href="#">和歌山</a></li>
  <li class="pref chugoku"><a href="#">鳥取</a></li>
  <li class="pref chugoku"><a href="#">島根</a></li>
  <li class="pref chugoku"><a href="#">岡山</a></li>
  <li class="pref chugoku"><a href="#">広島</a></li>
  <li class="pref chugoku"><a href="#">山口</a></li>
  <li class="pref shikoku"><a href="#">徳島</a></li>
  <li class="pref shikoku"><a href="#">香川</a></li>
  <li class="pref shikoku"><a href="#">愛媛</a></li>
  <li class="pref shikoku"><a href="#">高知</a></li>
  <li class="pref kyushu"><a href="#">福岡</a></li>
  <li class="pref kyushu"><a href="#">佐賀</a></li>
  <li class="pref kyushu"><a href="#">長崎</a></li>
  <li class="pref kyushu"><a href="#">熊本</a></li>
  <li class="pref kyushu"><a href="#">大分</a></li>
  <li class="pref kyushu"><a href="#">宮崎</a></li>
  <li class="pref kyushu"><a href="#">鹿児島</a></li>
  <li class="pref kyushu"><a href="#">沖縄</a></li>
<h2>div &gt; (input + label)</h2>
<div id="gridmap-cbox" class="gridmap">
  <input type="checkbox" name="pref" id="cb01"><label for="cb01" class="pref hokkaido">北海道</label>
  <input type="checkbox" name="pref" id="cb02"><label for="cb02" class="pref tohoku">青森</label>
  <input type="checkbox" name="pref" id="cb03"><label for="cb03" class="pref tohoku">岩手</label>
  <input type="checkbox" name="pref" id="cb04"><label for="cb04" class="pref tohoku">宮城</label>
  <input type="checkbox" name="pref" id="cb05"><label for="cb05" class="pref tohoku">秋田</label>
  <input type="checkbox" name="pref" id="cb06"><label for="cb06" class="pref tohoku">山形</label>
  <input type="checkbox" name="pref" id="cb07"><label for="cb07" class="pref tohoku">福島</label>
  <input type="checkbox" name="pref" id="cb08"><label for="cb08" class="pref kanto">茨城</label>
  <input type="checkbox" name="pref" id="cb09"><label for="cb09" class="pref kanto">栃木</label>
  <input type="checkbox" name="pref" id="cb10"><label for="cb10" class="pref kanto">群馬</label>
  <input type="checkbox" name="pref" id="cb11"><label for="cb11" class="pref kanto">埼玉</label>
  <input type="checkbox" name="pref" id="cb12"><label for="cb12" class="pref kanto">千葉</label>
  <input type="checkbox" name="pref" id="cb13"><label for="cb13" class="pref kanto">東京</label>
  <input type="checkbox" name="pref" id="cb14"><label for="cb14" class="pref kanto">神奈川</label>
  <input type="checkbox" name="pref" id="cb15"><label for="cb15" class="pref chubu">新潟</label>
  <input type="checkbox" name="pref" id="cb16"><label for="cb16" class="pref chubu">富山</label>
  <input type="checkbox" name="pref" id="cb17"><label for="cb17" class="pref chubu">石川</label>
  <input type="checkbox" name="pref" id="cb18"><label for="cb18" class="pref chubu">福井</label>
  <input type="checkbox" name="pref" id="cb19"><label for="cb19" class="pref chubu">山梨</label>
  <input type="checkbox" name="pref" id="cb20"><label for="cb20" class="pref chubu">長野</label>
  <input type="checkbox" name="pref" id="cb21"><label for="cb21" class="pref chubu">岐阜</label>
  <input type="checkbox" name="pref" id="cb22"><label for="cb22" class="pref chubu">静岡</label>
  <input type="checkbox" name="pref" id="cb23"><label for="cb23" class="pref chubu">愛知</label>
  <input type="checkbox" name="pref" id="cb24"><label for="cb24" class="pref kinki">三重</label>
  <input type="checkbox" name="pref" id="cb25"><label for="cb25" class="pref kinki">滋賀</label>
  <input type="checkbox" name="pref" id="cb26"><label for="cb26" class="pref kinki">京都</label>
  <input type="checkbox" name="pref" id="cb27"><label for="cb27" class="pref kinki">大阪</label>
  <input type="checkbox" name="pref" id="cb28"><label for="cb28" class="pref kinki">兵庫</label>
  <input type="checkbox" name="pref" id="cb29"><label for="cb29" class="pref kinki">奈良</label>
  <input type="checkbox" name="pref" id="cb30"><label for="cb30" class="pref kinki">和歌山</label>
  <input type="checkbox" name="pref" id="cb31"><label for="cb31" class="pref chugoku">鳥取</label>
  <input type="checkbox" name="pref" id="cb32"><label for="cb32" class="pref chugoku">島根</label>
  <input type="checkbox" name="pref" id="cb33"><label for="cb33" class="pref chugoku">岡山</label>
  <input type="checkbox" name="pref" id="cb34"><label for="cb34" class="pref chugoku">広島</label>
  <input type="checkbox" name="pref" id="cb35"><label for="cb35" class="pref chugoku">山口</label>
  <input type="checkbox" name="pref" id="cb36"><label for="cb36" class="pref shikoku">徳島</label>
  <input type="checkbox" name="pref" id="cb37"><label for="cb37" class="pref shikoku">香川</label>
  <input type="checkbox" name="pref" id="cb38"><label for="cb38" class="pref shikoku">愛媛</label>
  <input type="checkbox" name="pref" id="cb39"><label for="cb39" class="pref shikoku">高知</label>
  <input type="checkbox" name="pref" id="cb40"><label for="cb40" class="pref kyushu">福岡</label>
  <input type="checkbox" name="pref" id="cb41"><label for="cb41" class="pref kyushu">佐賀</label>
  <input type="checkbox" name="pref" id="cb42"><label for="cb42" class="pref kyushu">長崎</label>
  <input type="checkbox" name="pref" id="cb43"><label for="cb43" class="pref kyushu">熊本</label>
  <input type="checkbox" name="pref" id="cb44"><label for="cb44" class="pref kyushu">大分</label>
  <input type="checkbox" name="pref" id="cb45"><label for="cb45" class="pref kyushu">宮崎</label>
  <input type="checkbox" name="pref" id="cb46"><label for="cb46" class="pref kyushu">鹿児島</label>
  <input type="checkbox" name="pref" id="cb47"><label for="cb47" class="pref kyushu">沖縄</label>


                body {
  font-family: sans-serif;
  font-size: 0.75em;

.gridmap {
  display: grid;
    "... p01 p01 p01 p01 p01 p01 p01 ... ... ... ... p02 p02 p02 p02" 1fr
    "... p01 p01 p01 p01 p01 p01 p01 ... ... ... ... p05 p05 p03 p03" 1fr
    "... p01 p01 p01 p01 p01 p01 p01 ... ... ... ... p06 p06 p04 p04" 1fr
    "... ... ... ... ... ... ... ... ... p17 p16 p15 p15 p07 p07 p07" 1fr
    "p41 p40 p40 p35 p32 p32 p31 p28 p26 p18 p21 p20 p10 p09 p09 p08" 1fr
    "p42 p43 p44 p35 p34 p34 p33 p28 p26 p25 p21 p20 p11 p11 p11 p08" 1fr
    "... p43 p45 p38 p38 p37 p37 p27 p29 p24 p23 p20 p19 p13 p13 p12" 1fr
    "p47 p46 p45 p39 p39 p36 p36 p30 p30 p24 p23 p22 p22 p14 p14 p12" 1fr
    /2fr 2fr 2fr 2fr 1fr 1fr 2fr 2fr 2fr 2fr 2fr 2fr 2fr 1fr 1fr 2fr;
  gap: 2px;
  grid-gap: 2px;
  width: 50em;
  height: 20em;
  margin: 1em 0;
  padding: 0;
  input {
    display: none;

.pref {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.2em;
  transition: all 0.2s ease;
  &:hover, &:active, input:checked + & {
    font-weight: bold;
  a {
    width: 100%;
    height: 100%;
    text-decoration: inherit;
    color: inherit;
    border-radius: inherit;
    display: inherit;
    align-items: inherit;
    justify-content: inherit;

  $region-color: (
    hokkaido: hsl(240, 100%, 50%),
    tohoku  : hsl(195, 100%, 50%),
    kanto   : hsl(150, 100%, 50%),
    chubu   : hsl(105, 100%, 50%),
    kinki   : hsl( 60, 100%, 50%),
    chugoku : hsl( 15, 100%, 50%),
    shikoku : hsl(330, 100%, 50%),
    kyushu  : hsl(285, 100%, 50%)
  @each $region, $color in $region-color {
    &.#{$region} {
      color: darken($color, 25%);
      background-color: lighten($color, 40%);
      border: 1px solid darken($color, 25%);
      &:hover {
        color: darken($color, 25%);
        background-color: lighten($color, 30%);
        border: 2px solid darken($color, 25%);
      &:active, input:checked + & {
        color: white;
        background-color: darken($color, 20%);
        border: 2px solid darken($color, 20%);

  @for $i from 1 through 9 {
    &:nth-of-type(#{$i}) { grid-area: p0#{$i}; }
  @for $i from 10 through 47 {
    &:nth-of-type(#{$i}) { grid-area: p#{$i}; }

  $outer-radius: 1.2em;
  // 北海道、沖縄:四隅を角丸に
  &:nth-of-type(1), &:nth-of-type(47) {
    border-radius: $outer-radius;
  // 青森、石川、山口、愛媛、佐賀:北西を角丸に
  &:nth-of-type(2), &:nth-of-type(17), &:nth-of-type(35), &:nth-of-type(38), &:nth-of-type(41) {
    border-top-left-radius: $outer-radius;
  // 青森、香川、福岡:北東を角丸に
  &:nth-of-type(2), &:nth-of-type(37), &:nth-of-type(40) {
    border-top-right-radius: $outer-radius;
  // 千葉、神奈川、三重、徳島、長崎、宮崎:南東を角丸に
  &:nth-of-type(12), &:nth-of-type(14), &:nth-of-type(24), &:nth-of-type(36), &:nth-of-type(42), &:nth-of-type(45) {
    border-bottom-right-radius: $outer-radius;
  // 千葉、愛知、和歌山、山口、高知、長崎、鹿児島:南西を角丸に
  &:nth-of-type(12), &:nth-of-type(23), &:nth-of-type(30), &:nth-of-type(35), &:nth-of-type(39), &:nth-of-type(42), &:nth-of-type(46) {
    border-bottom-left-radius: $outer-radius;