Search code examples
csshtmlautoprefixer

CSS Animation: why does it not work in firefox when generated by autoprefixer


I am using autoprefixer and think that keyframes in firefox dont have to be prefixed. (Using latest FF38)

My original CSS

.blinking-cursor {
  font-weight: 100;
  font-size: 1rem;
  color: #2E3D48;
  animation: 1s blink step-end infinite;
}

@keyframes "blink" {
  from, to {
    color: transparent;
  }
  50% {
    color: black;
  }
}
<span class="blinking-cursor">|</span>

Generated CSS by autoprefixer

.blinking-cursor {
  display:block;
  font-weight: 100;
  font-size: 30px;
  color: #2E3D48;
  -webkit-animation: 1s blink step-end infinite;
  animation: 1s blink step-end infinite;
}
@keyframes "blink" {
  from, to {
    color: transparent;
  }
  50% {
    color: black;
  }
}
@-webkit-keyframes "blink" {
  from, to {
    color: transparent;
  }
  50% {
    color: black;
  }
}
<span class="blinking-cursor">|</span>

Then why does the cursor not animate while it animates if -moz was used http://codepen.io/ArtemGordinsky/pen/GnLBq


Solution

  • Remove the quotes " around the animation names in your keyframes declaration. The animation name is an identifier, and not a string.

    @keyframes "blink" {
      from, to {
        color: transparent;
      }
      50% {
        color: black;
      }
    }