htmlcssanimationkeyframe

Why does my animation doesn't work on my css?


I have a little problem and I need a second eye on it, here is it: I created an animation for bar progression but seems it's doesn't work and I can't figure why

.prog {
  height: 25px;
  border-radius: 25px;
}
.loading_container {
  width: 40%;
  margin: auto;
  border: 3px solid #9985FB;
  background-color: grey;
  box-shadow: 0 0 15px #9985FB;
}
.progess_bar {
  width: 0;
  background-color: red;
  animation: progress_bar 10s infinite;
}
@keyframes progress_bar {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}
<div class="prog loading_container">
  <div class="prog progress_bar">
  </div>
</div>

I can't figure out where is the problem all attributes seems fine and every bracket is open and closed. Thanks for your time in advance.


Solution

  • In your stylesheet,

    should be:


    Working Example:

    .prog {
      height: 25px;
      border-radius: 25px;
    }
    .loading_container {
      width: 40%;
      margin: auto;
      border: 3px solid #9985FB;
      background-color: grey;
      box-shadow: 0 0 15px #9985FB;
    }
    .progress_bar {
      width: 0;
      background-color: red;
      animation: progress_bar 10s infinite;
    }
    @keyframes progress_bar {
      0% {
        width: 0;
      }
      100% {
        width: 100%;
      }
    }
    <div class="prog loading_container">
      <div class="prog progress_bar">
      </div>
    </div>