如果要让.style 中的样式生效,可以将它们添加到对应的 CSS 选择器中。在这种情况下,可以将.element.style 样式添加到 div.tSXOCvQc 选择器中,如下所示:

div.tSXOCvQc {
    display: flex;
    flex-direction: column;
    height: auto;
    pointer-events: none;
    position: absolute;
    width: 100%;
    z-index: 2;
    bottom: 6px;
}

这样就可以让.style 中的样式生效,并覆盖掉原来的样式。

另外,如果要添加过渡效果,可以在样式中添加对应的 transition 属性,如下所示:

div.tSXOCvQc {
    display: flex;
    flex-direction: column;
    height: auto;
    pointer-events: none;
    position: absolute;
    width: 100%;
    z-index: 2;
    bottom: 6px;
    transition: all .3s;
}

通过添加 transition 属性,可以让样式改变时产生过渡效果。

CSS 样式覆盖与过渡效果:如何让 element.style 样式生效

原文地址: https://www.cveoy.top/t/topic/pklz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录