不同缩放级别的媒体查询浏览器级别

编程入门 行业动态 更新时间:2024-10-28 20:17:55
本文介绍了不同缩放级别的媒体查询浏览器级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是使用CSS3媒体查询的响应式设计的新手。我清楚地了解我们如何使用这些媒体查询定位不同的设备,但我困惑的地方是BROWSER ZOOMING !!

I am a newbie to responsive design using CSS3 media queries. I clearly understand how we target different devices using these media queries but the place where i am confused is BROWSER ZOOMING!!.

例如:这是我正常的身体css规则

For Eg: This is my normal body css rule

#body { margin: 0 auto; width: 70%; clear: both; }

,当我想更改此css规则以定位宽度下降的设备时在150像素和600像素的范围,我添加这个特定的媒体查询。

and when i want to change this css rule to target a devices whose width falls in the range of 150px and 600px i add this particular media query.

@media only screen and (min-width:150px) and (max-width:600px){ #body { margin: 0 auto; width: 90%; clear: both; } }

问题:我使用Google Chrome,当我放大到大约200%,然后这个特定的媒体查询发挥作用。

Problem: I am using Google Chrome and when i zoom in to about 200% then this particular media query comes into play.

我如何知道要为不同的缩放级别编写什么媒体查询,或者以另一种方式显示浏览器缩放级别和像素宽度之间的关系。

推荐答案

我找到了我的答案。

After a lot searching. I found my answer.

  • 我们不需要使用媒体查询功能明确指定浏览器缩放。当我们放大浏览器时,它表现为不同的设备。 例如:如果我们放大到175%的水平,我们屏幕尺寸的像素宽度是732像素(你可以在 mqtest.io/ ),这是附近的768px的ipad迷你。 ,因此您可以通过使用公共媒体查询 (即 @media屏幕和(min-width:732px))来同时定位Ipad mini和浏览器缩放(@ 175% 因此,如果您使用媒体查询定位不同的设备(对不同的设备启用网站响应),则您的浏览器缩放本身也会考虑。 p>

  • We don't need to target browser zooming explicitly by using media queries. When we zoom into our browser it behaves as different devices. For eg: If we zoom at level 175% the pixel width of our screen size is 732px ( You can find relation between zooming and pixel width at mqtest.io/ ) which is nearby 768px of ipad mini. therefore you can target both Ipad mini and browser zooming(@175%) by using a common media query i.e @media screen and (min-width:732px) So if you target different devices using media queries (make site responsive for different Devices) then your browser zooming is itself taken into account.

更多推荐

不同缩放级别的媒体查询浏览器级别

本文发布于:2023-11-09 16:17:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572836.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:级别   缩放   浏览器   媒体

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!