Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simulate device-width and orientation in browser to test media queries?

I'm developing my website locally and using Chrome to preview it as I go. While it's really easy to resize the browser to test media queries that use max/min-width, it's not possible from what I can tell to simulate max/min-device-width with any built in settings. Is there a Chrome extension that will simulate a mobile device and trigger media queries, specifically max/min-device-width and also orientation:portrait/landscape?

I basically would like some way to test this media query with Chrome on my computer rather than a smartphone:
@media only screen and (max-device-width: 600px) and (orientation: portrait)

like image 664
Jordan H Avatar asked Dec 15 '13 22:12

Jordan H


People also ask

Can we use media queries to design our web page according to the orientation of our devices?

Media queries can also be used to change layout of a page depending on the orientation of the browser.

How do you set the width and height of a media query?

Use a comma to specify two (or more) different rules: @media screen and (max-width: 995px), screen and (max-height: 700px) { ... } Commas are used to combine multiple media queries into a single rule. Each query in a comma-separated list is treated separately from the others.

Can media queries determine the size of a viewport?

Media queries can be used to check many things, such as: width and height of the viewport. width and height of the device. orientation (is the tablet/phone in landscape or portrait mode?)


1 Answers

Mobile device emulation is available as a built-in feature for Chrome, currently in the Beta channel. You need to enable it in the DevTools settings.

like image 189
rsanchez Avatar answered Nov 09 '22 04:11

rsanchez