强制应用媒体查询

Nao*_*aor 9 css css3 media-queries

我有这个HTML和CSS代码:

<div class="wrapper">
    <div class="a"></div>
    <div class="b"></div>
</div>

@media all and (max-width: 400px), (max-height: 300px) {
    .wrapper .a {
        ....
        ....
    }
    wrapper. .b {
        ....
        ....
    }
    ....
    ....
}
Run Code Online (Sandbox Code Playgroud)

现在我希望每当包装器获得"类似小"的类时,即使屏幕不小,所有小屏幕样式也将适用.我不想在媒体查询中复制css代码.我怎么解决这个问题?

另一种解决方案是强制应用媒体查询.有什么办法吗?

Axe*_*aul -3

为这些部分添加相同的类。

<div class="wrapper">
    <div class="makeMeShine a"></div>
    <div class="makeMeShine b"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

其中 a 和 b 可以有自己的自定义样式:)