我试图让我的响应式 CSS 样式仅适用于平板电脑和智能手机。基本上我有桌面风格,移动风格:纵向和移动风格:横向。我根本不希望移动样式干扰桌面演示。我玩过无数媒体查询,但结果要么移动样式显示在桌面上,要么移动样式仅显示在移动设备上但只有一组规则(无响应)。有没有办法让两者完全分开?
我现在的代码是这样的:
/* regular desktop styles */
@media only screen
and (max-device-width: 600px)
{ ... }
/* mobile only styles when the device is 0-600px in maximum width */
@media only screen
and (max-device-width: 1000px)
{ ... }
/* mobile only styles when the device is up to 1000px in maximum width */