Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <h1>Kasparov <div class="clock">VS</div> Deep Blue</h1>
<div id="container">
  <div id="chessboard">
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  <div class="row">
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
    <div class="cell"></div>
  </div>
  </div>
  <div id="notes">
    <div class="leftCol title">Kasparov</div>
    <div class="rightCol title">Deep Blue</div>
    <div class="leftCol">Kt. f3</div>
    <div class="rightCol">d5</div>
    <div class="leftCol">d4</div>
    <div class="rightCol">c6</div>
    <div class="leftCol">c4</div>
    <div class="rightCol">e6</div>
    <div class="leftCol">Kt. b d2</div>
    <div class="rightCol">Kt. f6</div>
    <div class="leftCol">e3</div>
    <div class="rightCol">Kt. b d7</div>
    <div class="leftCol">B d3</div>
    <div class="rightCol">B d6</div>
    <div class="leftCol">e4</div>
    <div class="rightCol">de4</div>
    <div class="leftCol">e4</div>
    <div class="rightCol">O-O</div>
    <div class="leftCol">O-O</div>
    <div class="rightCol">h6</div>
    <div class="leftCol">B c2</div>
    <div class="rightCol">e5</div>
    <div class="leftCol">R e1</div>
    <div class="rightCol">ed4</div>
  </div>
</div>
              
            
!

CSS

              
                *,
*::after,
*::before {
  box-sizing: border-box;
  transform-style: preserve-3d;
}
body {
  perspective: 1000px;
  height: 100vh;
  width: 100vw;
  margin: 0;
  background: radial-gradient(circle at 50% 50%, #fff 0%, #7EC0EE 200%);
  overflow: hidden;
  font-family: 'Roboto';
  font-weight: 300
}
h1 {
  margin: 50px auto;
  text-align: center;
  position: relative;
  font-family:'Montserrat';
  letter-spacing: -3px;
  font-sizE: 36px;
  color:#fff;
  z-index: 10;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5), 0 -1px 1px rgba(220,220,220,0.5);
}
h1::after {
  content:'';
  position: absolute;
  width: 0px;
  height: 5px;
  background: #50bff0;
  bottom: -10px;
  left: 50%;
  margin-left: -144px;
  transition: all .5s;
}
h1.kas::after {
  width: 146px;
   margin-left: -217px;
}
h1::before {
  content:'';
  position: absolute;
  width: 0px;
  height: 5px;
  background: #5090f0;
  bottom: -10px;
  right: 50%;
  margin-right: -141px;
  transition: all .5s;
}
h1.dbl::before {
  width: 158px;
  margin-right: -220px;
}
.clock {
  position: relative;
  display: inline-block;
  margin: 0 20px;
  width: 80px;
  height: 80px;
  top: 26px;
  color:#fff;
  font-size: 30px;
  font-weight: 400;
  line-height: 80px;
  text-align: center;
  border-radius: 50%;
  box-sizing: border-box;
  text-shadow: none;
  border: 3px solid rgba(255,255,255,0.95);
  background: #50bff0;
  transition: all .25s;
  overflow:hidden;
  z-index: 5
}
.clock.dbl {
  background: #5090f0;
}
.clock.kas::before,
.clock.dbl::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  content:'';
  background: #84D2F5;
  transform-origin: 0% 50%;
  transform: rotateZ(0deg);
  z-index: -1;
  animation: rotateBefore 2s linear infinite;
}
.clock.kas::after,
.clock.dbl::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  content:'';
  transform-origin: 100% 50%;
  transform: rotateZ(0deg);
  animation: rotateAfter 2s linear infinite;
}
@keyframes rotateBefore {
  0% {
    transform: rotateZ(180deg);
  }
  50% {
    transform: rotateZ(360deg);
  }
  100% {
    transform: rotateZ(360deg)
  }
}
@keyframes rotateAfter {
  0% {
    background: inherit;
    transform: rotateZ(0deg);
    z-index: -1
  }
  50% {
    background: inherit;
    transform: rotateZ(0deg);
    z-index: -1
  }
  50.1% {
    background: #84D2F5;
    transform: rotateZ(180deg);
    z-index: -3
  }
  100% {
    background: #84D2F5;
    transform: rotateZ(360deg);
    z-index: -3
  }
}
#container {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -240px 0 0 -210px;
  width: 350px;
  height: 350px;
  border: 30px solid #A35617;
  background: #AF5F1F;
  box-shadow:
    /*
    0 5px 0px -1px #8A4A16,
    0 10px 0px -2px #83430f,
    0 15px 0px -3px #7c3c00,
    0 20px 0px -4px #753500,
    */
    inset 1px 1.5px 5px rgba(0,0,0,0.75),
    inset 0 0 0px 15px rgba(255,255,255,0.15),
    10px 20px 15px 2px rgba(0,0,0,0.5);
  box-sizing: content-box;
  transform: rotateX(50deg) rotateZ(28deg); 
  transition: all 3s;-z
  z-index: 1
}
#container:hover {
  box-shadow: 
    /*
    2.5px 5px 0px -1.5px #8A4A16,
    5px 10px 0px -3px #83430f,
    7.5px 15px 0px -4.5px #7c3c00,
    10px 20px 0px -6px #753500,
    */
    inset 0 3px 5px rgba(0,0,0,0.75),
    inset 0 0 0px 15px rgba(255,255,255,0.15),
    0 20px 15px 2px rgba(0,0,0,0.5);
  transform: rotateX(20deg) rotateZ(0deg); 
}
#container::before {
   background: 
    linear-gradient(
      to bottom, #A35617 0%,
      #A35617 100%);
  content:'';
  position: absolute;
  width: calc(100% + 60px);
  height: 20px;
  bottom: -50px;
  left: -30px;
  transform-origin: 100% 0%;
  transform:  rotateZ(90deg) rotateX(-90deg);
}
#container::after {
  background: 
    linear-gradient(
      to bottom, #A35617 0%,
      #A35617 100%);
  content:'';
  position: absolute;
  width: calc(100% + 60px);
  height: 20px;
  bottom: -50px;
  left: -30px;
  transform-origin: 100% 0%;
  transform: rotateX(-90deg);
  
}
#chessboard {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 320px;
  height: 320px;
}
#chessboard::after{
  
}
.row {
  position: relative;
  width: 100%;
  height: 40px;
  perspective: 1000px
}
.cell {
  float: left;
  width: 40px;
  height: 40px;
  background: #FAE8AF;
  transition: all .5s
}
.row:nth-child(odd) .cell:nth-child(even),
.row:nth-child(even) .cell:nth-child(odd){
  background: #6B3A16;
}

.holo {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(150,50,50,1);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transform: translateZ(10px);
  text-align: center;
  line-height: 20px;
  font-size: 13px;
  box-shadow: 0 0px 1px rgba(0,0,0,.25);
}
.holo::before,
.holo::after {
  position: absolute;
  top:0; left:0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  content:'';
  background: rgba(130,30,30,1);
  transform: translateZ(-5px);
  transition: all 3s
}
.holo::after {
  background: rgba(110,10,10,1);
  transform: translateZ(-9px);
  box-shadow: 0 3px 5px rgba(0,0,0,0.5);
}
#container:hover .holo::after {
  box-shadow: 1px 1.5px 5px rgba(0,0,0,0.5);
}
.holo.white {
  background: rgb(200,200,200);
}
.holo.white::before {
  background: rgb(150,150,150);
}
.holo.white::after {
  background: rgb(100,100,100);
}
.holo.black {
  background: rgb(90,90,90);
  color:#f0f0f0;
}
.holo.black::before {
  background: rgb(60,60,60);
}
.holo.black::after {
  background: rgb(30,30,30);
}

#notes {
  width: 200px; height: 300px;
  background: #f0f0f0;
  background-image:
    repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 20px, 
    #ccc 20px, #ccc 21px), 
    repeating-linear-gradient(
      to right,
      transparent 0px,
      transparent 80px,
      #ccc 80px, #ccc 81px
    );
  
  border: 20px solid #f0f0f0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.25);
  position: absolute; 
  top: 40%;
  right: -225px;
  z-index: 1;
  transition: all 3s 1s, box-shadow 1s 0s;
  cursor: pointer;
  transform: rotateZ(10deg) scale(0.5);
}
#notes.read {
  z-index: 200;
  right: 50%;
  margin-top: -75px;
  margin-right: -100px;
  transform: rotateZ(0deg) rotateX(-20deg) translateZ(150px) scale(1);
  box-shadow: 0 0 1000px 1000px rgba(0,0,0,0.5);
  transition: all 3s 0s, box-shadow 1s 3s;
}
#notes::after,
#notes::before {
  box-sizing: content-box;
  position: absolute;
  content:'';
  width: 100%;
  height: 100%;
  top: -20px;
  left: -20px;
  background: #f0f0f0;
  border: 20px solid #f0f0f0;
  z-index: 0;
  box-shadow: 0 2px 3px rgba(0,0,0,0.25);
  transform: translateZ(-1px) rotateZ(5deg);
  transition: all 3s;
}
#notes::after {
  transform: translateZ(-1px) rotateZ(-2deg);
}
#container:h over #notes,
#container:h over #notes::after,
#container:h over #notes::before {
  box-shadow: 1px 1px 3px rgba(0,0,0,.25);
}
.leftCol,.rightCol {
  position: relative;
  float: left;
  width: 50%;
  line-height:21px;
  height: 21px;
  font-size: 14px;
  text-align: center;
  font-family:'Indie Flower';
  opacity: 0;
}
.rightCol.title,.leftCol.title {
  font-size: 16px;
  font-weight: bold;
  opacity: 1;
}
              
            
!

JS

              
                function init(){
  $('.row').each(function(ri){
    $r = $(this);
    $r.children('.cell').each(function(rc){
      $c = $(this);
      switch(ri){
        case 0:
          CL = 'black';
          switch(rc){
            case 0: name = 'R'; id="rb1"; break;
            case 1: name = 'Kt'; id="ktb1"; break;
            case 2: name = 'B'; id="bb1"; break;
            case 3: name = 'Q'; id="qb"; break;
            case 4: name = 'K'; id="kb"; break;
            case 5: name = 'B'; id="bb2"; break;
            case 6: name = 'Kt'; id="ktb2"; break;
            case 7: name = 'R'; id="rb2"; break;
            default: draw = 0; break;
          }
          draw = 1;
        break;
        case 1:
          CL = 'black';
          name = 'P'; id = 'pb'+parseInt(rc+1);
          draw = 1;
        break;
        case 6:
          CL = 'white';
          name = 'P'; id = 'pw'+parseInt(rc+1);
          draw = 1;
        break;
        case 7:
          CL = 'white';
          switch(rc){
            case 0: name = 'R'; id="rw1"; break;
            case 1: name = 'Kt'; id="ktw1"; break;
            case 2: name = 'B'; id="bw1"; break;
            case 3: name = 'Q'; id="qw"; break;
            case 4: name = 'K'; id="kw"; break;
            case 5: name = 'B'; id="bw2"; break;
            case 6: name = 'Kt'; id="ktw2"; break;
            case 7: name = 'R'; id="rw2"; break;
            default: draw = 0; break;
          }
          draw = 1;
        break;
        default: draw = 0; break;
      }
      if(draw) $c.html('<div class="holo '+CL+'" id="'+id+'">'+name+'</div>');
    });
  });
}
function game(t) {
  at = 1000;
  //1
  setTimeout(function(){
    $('.clock').html('1').addClass('kas');
    $('h1').addClass('kas');
  },at);
  setTimeout(function(){
    $("#ktw2").animate({top:'-70px',left:'-30px'},at);
    $(".leftCol:eq(1)").animate({opacity:1},at);
  },t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },t+at);
  setTimeout(function(){
    $("#pb4").animate({top:'90px'},at);
    $(".rightCol:eq(1)").animate({opacity:1},at);
  },2*t);
  //2
  setTimeout(function(){
    $('.clock').html('2').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },2*t+at);
  setTimeout(function(){
    $("#pw4").html('1').animate({top:'-70px'},at);
    $(".leftCol:eq(2)").animate({opacity:1},at);
  },3*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },3*t+at);
  setTimeout(function(){
    $("#pb3").animate({top:'50px'},at);
    $(".rightCol:eq(2)").animate({opacity:1},at);
  },4*t);
  //3
  setTimeout(function(){
    $('.clock').html('3').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },4*t+at);
  setTimeout(function(){
    $("#pw3").animate({top:'-70px'},at);
    $(".leftCol:eq(3)").animate({opacity:1},at);
  },5*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },5*t+at);
  setTimeout(function(){
    $("#pb5").animate({top:'50px'},at);
    $(".rightCol:eq(3)").animate({opacity:1},at);
  },6*t);
  //4
  setTimeout(function(){
    $('.clock').html('4').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },6*t+at);
  setTimeout(function(){
    $("#ktw1").animate({top:'-30px',left:'90px'},at);
    $(".leftCol:eq(4)").animate({opacity:1},at);
  },7*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },7*t+at);
  setTimeout(function(){
    $("#ktb2").animate({top:'90px',left:'-30px'},at);
    $(".rightCol:eq(4)").animate({opacity:1},at);
  },8*t);
  //5
  setTimeout(function(){
    $('.clock').html('5').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },8*t+at);
  setTimeout(function(){
    $("#pw5").animate({top:'-30px'},at);
    $(".leftCol:eq(5)").animate({opacity:1},at);
  },9*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },9*t+at);
  setTimeout(function(){
    $("#ktb1").animate({top:'50px',left:'90px'},at);
    $(".rightCol:eq(5)").animate({opacity:1},at);
  },10*t);
  //6
  setTimeout(function(){
    $('.clock').html('6').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },10*t+at);
  setTimeout(function(){
    $("#bw2").animate({top:'-70px',left:'-70px'},at);
    $(".leftCol:eq(6)").animate({opacity:1},at);
  },11*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },11*t+at);
  setTimeout(function(){
    $("#bb2").animate({top:'90px',left:'-70px'},at);
    $(".rightCol:eq(6)").animate({opacity:1},at);
  },12*t);
  //7
  setTimeout(function(){
    $('.clock').html('7').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },12*t+at);
  setTimeout(function(){
    $("#pw5").animate({top:'-70px'},at);
    $(".leftCol:eq(7)").animate({opacity:1},at);
  },13*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },13*t+at);
  setTimeout(function(){
    $("#pb4").animate({top:'130px',left:'50px'},at);
    $("#pw5").animate({opacity:0},at,function(){
      $("#pw5").css({display:'none'});
    });
    $(".rightCol:eq(7)").animate({opacity:1},at);
  },14*t);
  //8
  setTimeout(function(){
    $('.clock').html('8').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },14*t+at);
  setTimeout(function(){
    $("#ktw1").animate({top:'-110px',left:'130px'},at);
    $("#pb4").animate({opacity:0},at,function(){
      $("#pb4").css({display:'none'});
    });
    $(".leftCol:eq(8)").animate({opacity:1},at);
  },15*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },15*t+at);
  setTimeout(function(){
    $("#ktb2").animate({top:'170px',left:'-70px'},at);
    $("#ktw1").animate({opacity:0},at,function(){
      $("#ktw1").css({display:'none'});
    });
    $(".rightCol:eq(8)").animate({opacity:1},at);
  },16*t);
  //9
  setTimeout(function(){
    $('.clock').html('9').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },16*t+at);
  setTimeout(function(){
    $("#bw2").animate({top:'-110px',left:'-30px'},at);
    $("#ktb2").animate({opacity:0},at,function(){
      $("#ktb2").css({display:'none'});
    });
    $(".leftCol:eq(9)").animate({opacity:1},at);
  },17*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },17*t+at);
  setTimeout(function(){
    $("#kb").animate({left:'90px'},at);
    $("#rb2").animate({left:'-70px'},at);
    $(".rightCol:eq(9)").animate({opacity:1},at);
  },18*t);
  //10
  setTimeout(function(){
    $('.clock').html('10').removeClass('dbl').addClass('kas');
    $('h1').removeClass('dbl').addClass('kas');
  },18*t+at);
  setTimeout(function(){
    $("#kw").animate({left:'90px'},at);
    $("#rw2").animate({left:'-70px'},at);
    $(".leftCol:eq(10)").animate({opacity:1},at);
  },19*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('kas').addClass('dbl');
  },19*t+at);
  setTimeout(function(){
    $("#pb8").animate({top:'50px'},at);
    $(".rightCol:eq(10)").animate({opacity:1},at);
  },20*t);
  setTimeout(function(){
    $('.clock,h1').removeClass('dbl kas');







    $('.clock').html('VS');
  },20*t+at);
}
$(document).ready(function(){
  init();
  $('#notes').click(function(){
    $(this).toggleClass('read');
  });
  setTimeout(function(){
    game(2000);
  },2000);
});
              
            
!
999px

Console