media query max-width relates to the view port size or the windows size?

六眼飞鱼酱① 提交于 2019-12-05 22:51:22

问题


I'm wondering if the max-width of a media query is relates to the view port size or the windows size?

for example , I have this media query:

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

will this media query be in action when the view port size is 360px or the windows size 360px?


回答1:


It's the viewport. This is stated in the spec:

The ‘width’ media feature describes the width of the targeted display area of the output device. For continuous media, this is the width of the viewport (as described by CSS2, section 9.1.1 [CSS21]) including the size of a rendered scroll bar (if any).

This also applies to sub-viewports within the main browser viewport, such as those of framesets and iframes. So if an iframe has a width of 360px or less, your media query will also apply within that iframe.



来源:https://stackoverflow.com/questions/13182201/media-query-max-width-relates-to-the-view-port-size-or-the-windows-size

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!