javascript - 媒体屏幕和最小宽度 : 965px and max-width: 965px

标签 javascript jquery css

@media screen and (min-width: 965px){
   //style here
}
@media screen and (max-width: 965px){
   //some other style
}

在小于或大于 965px 时一切正常,但是当屏幕出现 965px 错误时

有什么办法可以解决吗

最佳答案

调换顺序,在 2 之间给自己 1px 的余地。

@media screen and (max-width: 964px){
   //some style
}   


@media screen and (min-width: 965px){
   //style here
}

这样就没有重叠了。

注意:不建议在屏幕尺寸查询中使用 bot min 和 max width。如果你只使用 min-width,并从小到大列出它们,下面的将覆盖上面的。

关于javascript - 媒体屏幕和最小宽度 : 965px and max-width: 965px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40597097/

相关文章:

javascript - 带有动态模板的 Angularjs 加载屏幕

jquery - 如果按下按钮,有什么方法可以使图像大小为 %300?/已修复

javascript - Css 类样式不适用于 svg

javascript - jquery - 从本地文件系统加载 XML 文件而不会出现跨域错误

css - joomla 中的事件类链接

html - CSS 文本对齐中心不起作用

javascript - React 链接与标签和箭头函数

javascript - 在同一页面上再次重复此切换

javascript - 使用 node-sass 安装 angular-cli 时出错

javascript - 为什么以及何时我们应该在 ember.js 中使用 argument.length