html - 我的网站在缩放 100%+ 时一团糟

标签 html css media-queries

我开发的网站总是有这个问题。我使用了最大分辨率的媒体查询:

@media only screen and (max-width : 1920px) {}

如果页面缩放到 150%,是否有任何方法可以确保内容正确显示?我的许多元素都有绝对定位,所以如果我对其他元素使用最大宽度,我仍然会遇到问题。

最佳答案

是的……朝着正确方向迈出的一大步是开始使用 em 而不是 px 来设置媒体查询:

@media only screen and (max-width:120em){}

这考虑了缩放,而按像素设置它会在放大时全部变形。Here is a good article that talks about why to use em instead of px , 和 here is a good resource for px-to-em conversions .

关于html - 我的网站在缩放 100%+ 时一团糟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23280695/

相关文章:

css - 我可以将 CSS 应用于一个特定的 Ember.js 模板/路由吗

css - 媒体查询构建最佳实践

html - 仅删除文本区域底部的框阴影

html - 如何使用变换:translateX to move a child element horizontally 100% across the parent

javascript - 无法从外部 JavaScript 调用函数

html - 使用 twitter 的 bootstrap 和 Rails4 呈现列

html - div 的 :nth-child(2) background-color is also changing body background-color

html - asp.net mvc web 应用程序中我的 Razor View 的响应式设计

css - 为手机加载不同的 CSS(但不适用于平板电脑)

html - 宽度 100% 大于屏幕尺寸