简体   繁体   English

在确定分辨率后停止CSS样式更改-媒体查询?

[英]Stop CSS styles changing after a certain resolution - media query?

If the user reduces the browser window below a certain resolution, say 320 width, I dont want any further css layout changes to take effect. 如果用户将浏览器窗口减小到某个分辨率(例如320宽度)以下,则我不希望任何进一步的CSS布局更改生效。 Basically what ever the layout is at 320, I don't want to change this any further, it should just hold the 320 view. 基本上无论是320还是什么布局,我都不想再更改它,它只能容纳320视图。

Would I use a fixed width with a media query? 我会在媒体查询中使用固定宽度吗?

Yes a media query is exactly what would fulfill this purpose. 是的, 媒体查询正是可以满足此目的的。 Specifically: 特别:

<style>
  @media (max-width: 320px) {
    body {
      width: 320px;
    }
  }
</style>

And here is a demo 这是一个演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM