更新时间:2022-05-14 08:52:27
此方法有点多余,但是选择器具有更高的特异性,即使媒体查询匹配,选择器的属性也具有优先级.例如:
There is a bit of redundancy with this method, but a selector has higher specificity its properties have precedence even if a media query matches. For example:
.container, .full-site.container {
/* full site styles */
}
@media (max-width: 395px) {
.container {
/* mobile styles */
}
}
点击完整站点
时,添加 .full-site
类,即使在像素宽度为395的设备上,完整站点样式也将适用.
When full site
is clicked, add the .full-site
class and the full site styles will apply even on devices with a 395 pixel width.