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.


  - for (let i = 8; i > 0; i--)
    - for (let a = 0; a < 8; a++)
      div(id=String.fromCharCode(97 + a) + i)



  --chess-bg: #444
  --chess-color: hsla(180deg, 100%, 25%, .6) //teal
  --chess-color2: hsla(9deg, 100%, 64%, .6) //tomato
  display: grid
  grid-template-columns: repeat(8, minmax(0, 1fr))
  grid-template-rows: repeat(8, minmax(0, 1fr))
  width: 100%
  max-width: 90vh // vmin
  aspect-ratio: 1
  font-family: sans-serif
  font-weight: 600
  color: var(--chess-color)
  background-color: var(--chess-bg)
  //border: 2em solid var(--chess-color)
  //border-radius: 1em
  & > div
    display: flex
    justify-content: center
    align-items: center
    //padding: .3em
    font-size: 3vmin
      color: var(--chess-color2)
      background-color: #ddd
  & .piece
    position: relative
    font-size: 2.8em
    font-weight: normal
    font-family: sans-serif
    text-shadow: 0 0 .5em hsla(0, 50%, 0%, .25), 0 .2em .5em hsla(0, 50%, 0%, .25)
  & .black
    color: black
  & .white
    color: white

// for demo:
  box-sizing: border-box

  display grid
  place-items center
  min-height 100vh
  margin 0 1em
  background-color #333



                'use strict'

const init = () => {
  const chess = document.querySelector('.chess')
  const squares = chess.querySelectorAll('div')
  //;[...squares].map(square => console.log(
  const pieceOrigin = [ // @note À terme on utilisera des SVGs, le symbole sera remplacé par l'ID du sprite SVG. La couleur sera peut-être supprimée.
    ['a1', 'white', '♜'],
    ['b1', 'white', '♞'],
    ['c1', 'white', '♝'],
    ['d1', 'white', '♛'],
    ['e1', 'white', '♚'],
    ['f1', 'white', '♝'],
    ['g1', 'white', '♞'],
    ['h1', 'white', '♜'],
    ['a2', 'white', '♟'],
    ['b2', 'white', '♟'],
    ['c2', 'white', '♟'],
    ['d2', 'white', '♟'],
    ['e2', 'white', '♟'],
    ['f2', 'white', '♟'],
    ['g2', 'white', '♟'],
    ['h2', 'white', '♟'],
    ['a7', 'black', '♟'],
    ['b7', 'black', '♟'],
    ['c7', 'black', '♟'],
    ['d7', 'black', '♟'],
    ['e7', 'black', '♟'],
    ['f7', 'black', '♟'],
    ['g7', 'black', '♟'],
    ['h7', 'black', '♟'],
    ['a8', 'black', '♜'],
    ['b8', 'black', '♞'],
    ['c8', 'black', '♝'],
    ['d8', 'black', '♛'],
    ['e8', 'black', '♚'],
    ['f8', 'black', '♝'],
    ['g8', 'black', '♞'],
    ['h8', 'black', '♜']
  ] => document.getElementById(x[0]).innerHTML = `<div class="piece ${x[1]}">${x[2]}</div>`)