title: Making a moving border animation work on a square element
body: <p>I am trying to get a moving border CSS animation to work on a square but I can't quite work out how to get it to work. It works fine on a circle as I just use the rotate transition with the key frames. This is my current markup.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.box {
    width: 50px;
    height: 50px;
    margin: 50px auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    position: relative;
    -webkit-transition: all 1s ease;
    transition: all 1s ease;
  }
  .box .border {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: 4px solid transparent;
    border-top-color: orangered;
    border-radius: 50%;
    animation-name: border;
    -webkit-animation-duration: 2s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-timing-function: linear;
  }
  @-webkit-keyframes border {
    from {
      -webkit-transform: rotate(0deg);
    }
    to {
      -webkit-transform: rotate(360deg);
    }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="box"&gt;
    &lt;div class="border"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>