media queries and firefox/chrome

2019-09-05 23:32发布

Hi so I have a media query that gets picked up by ios simulator

<link rel="stylesheet" media="all and (max-device-width: 480px)" href="css/iphone.css"> 

What I would like to do is simulate this on firefox or chrome by resizing the browser, is this possible?

3条回答
啃猪蹄的小仙女
2楼-- · 2019-09-05 23:55

You need to use max-width. max-device-width is the physical screen size so that won't change. See: What is the difference between max-device-width and max-width for mobile web?

However, that won't fully solve your problem for iOS because Safari reports a width (but not a device-width) of 980px by default, so pages not designed for mobile appear as a full zoomed-out page. So, you also need to add something like this to your HTML:

<meta name="viewport" content="initial-scale = 1.0">

You can find a reference from Apple on viewport settings here: http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html

查看更多
混吃等死
3楼-- · 2019-09-05 23:59
<link type="text/css" rel="stylesheet" href="css/iphone.css" media="all and (max-width: 480px)" />
查看更多
太酷不给撩
4楼-- · 2019-09-06 00:15

Yes you can directly simulate this on Firefox and chrome. But Firefox doesn't support media queries below 480.

You can also check the below link for re-size in Firefox & chrome. http://www.smashingmagazine.com/

Hope This Helps

查看更多
登录 后发表回答