When html element has multiple class names, style coverage problems

<div class="carousel-item carousel-item-active">

                </div>

Such code segments

.carousel-item-active {
    width: 39.722vw;
    height: 21.667vw;
    border-radius: 2.083vw;
    border: 0.833vw solid rgba(72, 155, 97, 1);
}

.carousel-item {
    width: 30.556vw;
    height: 16.667vw;
    background: rgba(255, 255, 255, 1);
    border-radius: 1.389vw;
    border: 0.278vw solid rgba(214, 214, 214, 1);
}
web前端开发学习Q-q-u-n: 731771211,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法(详细的前端项目实战教学视频,PDF)

The entry into force of the class name to the class style css file in the final definitions will

For example, the above code

Style is in effect carousel-item style

Then adjust the order of two styles in which style css

.carousel-item {
    width: 30.556vw;
    height: 16.667vw;
    background: rgba(255, 255, 255, 1);
    border-radius: 1.389vw;
    border: 0.278vw solid rgba(214, 214, 214, 1);
}

.carousel-item-active {
    width: 39.722vw;
    height: 21.667vw;
    border-radius: 2.083vw;
    border: 0.833vw solid rgba(72, 155, 97, 1);
}

Do not modify the html element

Then style this time is in effect carousel-item-active

That is

 width: 39.722vw;
    height: 21.667vw;
    border-radius: 2.083vw;
    border: 0.833vw solid rgba(72, 155, 97, 1);
web前端开发学习Q-q-u-n: 731771211,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法(详细的前端项目实战教学视频,PDF)

Summary: When a multiple-element binding class name, and the same style classes have multiple attributes, according to the order written into effect, EDITORIAL will be covered later, with the class name in the class attribute html writing relationship has a relationship

Published 263 original articles · won praise 15 · views 3895

Guess you like

Origin blog.csdn.net/weixin_45974707/article/details/104010881