JSFiddle - React, Tailwind, and code Playground

by cchana

HTML

<div class="padding">
  <div id="box">
  </div>
</div>

CSS

.box {
  height: 200px;
  width: 200px;
  margin: 200px;
  position: relative;
}

.box:before,
.box:after {
  content: '';
  height: 200px;
  width: 200px;
  border-style: solid;
  border-color: #000;
  position: absolute; animation-timing-function: linear;
}

.box:before {
  border-width: 1px 0 0 1px;
  left: 0;
  bottom: 0;
  animation: drawBox1 2s;
}
.box:after {
  border-width: 0 1px 1px 0;
  right: -1px;
  top: 1px;
  animation: drawBox2 4s;
}

.padding {
  
}

@keyframes drawBox1 {
  0%   { height: 0px; width: 0px; }
  50% { height: 200px; width: 0px; }
  100% { height: 200px; width: 200px; }
}

@keyframes drawBox2 {
  0%   { height: 0px; width: 0px; }
  50%   { height: 0px; width: 0px; }
  75% { height: 200px; width: 0px; }
  100% { height: 200px; width: 200px; }
}