как переопределить стиль с помощью! important в псевдоклассе: before - PullRequest
1 голос
/ 27 мая 2020

так вот ситуация. Я пытаюсь отключить всю анимацию. поэтому я вставляю этот класс в тело

class collection:
.no-transition * {
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
-o-transition: none !important;
transition: none !important;
}

It works for the most part, except for the toggle button that implements animation using:

.slider:before {
position: absolute;
content: '';
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: 0.4s;
transition: 0.4s;
}

.no-transition, похоже, не отменяет .slider: before Вся помощь будет оценена. Спасибо

1 Ответ

0 голосов
/ 27 мая 2020

Ну, это зависит от того, где совпадают ваши :before и .no-transition, но что-то вроде этого должно охватывать эти аспекты:

.no-transition *, .no-transition:before, .no-transition *:before {
    -webkit-transition: none !important;
    -moz-transition: none !important;
    -ms-transition: none !important;
    -o-transition: none !important;
    transition: none !important;
}
...