chupzzz
6/28/2017 - 10:25 AM

Simple CSS rotation of background-image. Can be used on element state changes (open, clicked, hover etc.)

Simple CSS rotation of background-image. Can be used on element state changes (open, clicked, hover etc.)

.title {
  position: relative;
  padding-right: 20px;
}
.title:before {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  top: 0;
  right: 0;
  background: transparent url(../img/accordion-arrow.svg?x) center center no-repeat;
  -webkit-background-size: 1.4rem;
  background-size: 1.4rem;
  transition: all 500ms;
}
.title.open:before {
  -webkit-transform:rotate(90deg);
  transform:rotate(90deg);
}