A
A
Alianos2021-05-05 15:10:41
css
Alianos, 2021-05-05 15:10:41

How to set a special style priority?

Hello, I'm making a slideshow and I need all frames to default to opacity:0, except for the first one where opacity:1.
But I also need classes with animation styles to take precedence over the default ones, how can I do this ...

.slideshow {
  width: 100%;
  height: 100%;

  @extend %animations;
  & div:first-child {
    opacity: 1; //дефолтный для первого, приоритетом больше чем "дефолтный для всех "
  }
}
::v-deep .frame {
  width: 100%;
  height: 100%;
  opacity: 0; //дефолтный для всех 
}

classes connected via classList.add must have a priority greater than those default ones that I wrote earlier, how to do this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danny Arty, 2021-05-05
@DanArst

You can use the default direct class selectors in CSS, and for pluggable use nested selectors. Conditionally like this:
Default:

.elementClass {
opacity: 0;
}

Connected:
.parent1Class .parent2Class .elementClass {
opacity: 1;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question