Pinch Zoom in a web page in Chrome Dev Tools - google-chrome

I am testing the rendering of my web application on iPad. However, I am not able to zoom into the page when using Chrome tools to simulate iPad under "Toggle Device Toolbar". I saw this answer, but the solution given there doesn't work with the tocuhpad on my Apple MacBook Pro.
How can I test pinch and zoom using the touchpad on my Macbook? Notice that increasing zoom level from the dropdown in "Toggle Device Toolbar" simply makes the entire viewport bigger in size, rather than zooming into the webpage (which can be achieved in desktop mode in Chrome by simply pressing ctrl and +).

Try this solution.
Hold down Shift at the same time you hold down the left-button of the mouse.
Now, a cross should appear on the dev-screen.
Then, move it up and/or down (z-axis) to zoom in or out.

Related

How to change font-size of dev-tools without zooming the web page itself

You can increase/decrease font size within chrome's developer toolbox by pressing CMD and + or - but it seems only to work in docked mode.
If I do that within an undocked separate window, it zooms in/out the web page too.
Is there a possibility to achieve the same in floating-window-mode?
EDIT: See related bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1100135

How do you write media queries for a larger screen than you own?

If I am limited to say a 1920 x 1080 screen, how do I create media queries for a larger screen size without being able to test it?
You can set any resolution in Chrome. Just click "Toggle device mode" in Inspector and set any resolution.
In Chrome Developer Tools, you can use Device Mode to emulate any resolution, not just mobile breakpoints.
If you are using Google Chrome, you can open the web inspector Ctrl-Shift-I, then toggle Device Mode using Ctrl-Shift-M. It's mainly used for smaller devices, but you should be able to select 'Responsive' in the menu that comes up at the top of the screen, and enter any resolution you wish, along with a zoom level so that you can view it on your screen, albeit scaled.
If you are using Safari, you can do this relatively easily.
If you aren't using Safari, you probably should get it, at least for website testing. As you can see on step 6, Safari has LOTS of VERY helpful dev tools (i.e. disable JS, disable CSS, etc.).
Here is some instructions with pictures!
Go to the Safari menu (in upper left hand corner).
On that menu click Preferences, this should open up a pop-up box.
On the pop-up box, click the Advanced tab.
At the very bottom of that tab you should see a checkbox that says Show Develop menu in menu bar, check that box.
Now load your website in Safari.
When your website has loaded (for this example I'm using SO), click on the Develop dropdown menu.
Click Enter Responsive Design Mode, and that will now show your website in a window smaller than your browser window.
In that window, click on the window looking thing on the far left.
There are little gray bars on all sides of that smaller window, if you drag these you can make the size whatever you want.
As a side note, when you drag the gray bars (as shown in step 9), you should see the width and height resolution (pixels) change (see screenshot below), this is VERY helpful (and I use it all the time), as it will tell you the exact resolution (pixels) when your website breaks. P.S. you can go to ANY screen resolution - big and small - that you want to with this tool, which is really cool! (I've done 2500 x 1500, 100 x 100, etc.)
Hope this helps you!

How can I test my webpage using phone gestures on desktop?

I'm having a problem with my webpage where it doesn't scroll on phones.
This is not my problem though. My problem is that it only happens on phones, and I need to debug is, but have no desire to debug from a cell phone (whether or not that's an option).
In firefox, I've tried using "Simulate touch events," but apparently (and I think this is a design flaw) that does not mean that clicking and dragging equates to the swipe gesture.
So how do I test my webpage with phone gestures on desktop?
Try these:
1.You could use a simulator specific to your phone's os.. for example Bluestacks for android.
2.Go to firefox and press Shift+F8
3.Press Ctrl+Shift+M on Chrome

test website on different screen resolution

One user reported me that on his 11 inch macbook air all messed up. Now I do not have idea how can I fix that. Maybe there is some tools that I can use to emulate 11 inch macbook air?
Thanks
If you're using Firefox 15 or later, you can use the responsive design view by pressing Ctrl-Shift-M or going to the Firefox menu -> Web Developer -> Responsive Design View. That lets you easily resize the page (from a list of common resolutions, or arbitrarily by dragging the edges) without having to resize your browser window (as well as letting you resize it larger than your window). Other browsers might have a similar feature, but I'm not sure.
If you press Ctrl + Shift + M in your keyboard on, Mozilla Firefox and/or Google Chrome, then they will launch the Responsive Design View (Firefox) or Device Toolbar (Chrome) mode. Here you can manually adjust the window width and height to a match any device dimensions you wish, or you can also select from a set of preset device dimension options. It also gives the option to view the selected dimensions in either landscape/ portrait mode (for portable devices such as mobile or tablets) to see how a/your website would look in those different orientations.
I am not sure about any other browsers, but you can try to use the above keyboard shortcut, on another browser of your choice and see if it works there aswell.
Alternatively you can manually toggle the Responsive Design View (Firefox) or Device Toolbar (Chrome) modes, by navigating to:
Firefox 59
Menu (hamburger icon on top right) > Web Developer > Responsive Design Mode
Chrome 65
Menu (Three-dot icon on top right) > More Tools > Developer Tools
OR
Simply press Ctrl + Shift + I to launch the Developer Tools
Once the Developer Tools has launched click on the toggle device toolbar icon on the top-left corner of the Developer Tools menu, to view the webpage in responsive design view.
Again, I am only aware of doing this in Mozilla Firefox and Google Chrome, so other browsers may have a similar or different approach.
UPDATE
Edge Browser (Windows 10)
Use the keyboard shortcut Ctrl + SHIFT + I, OR navigate to Menu (three-dot icon on top right) > F12 Developer Tools to open the developer tools Menu, then go to the Emulation tab to see options for customising the window to different device size and dimensions.
First, you do not need to emulate a 11 inch screen but the screen resolution because no matter the inch of the screen, resolution can have multiple values.
I would suggest you to use a pluggin like "web developper" available for firefox and chrome (don't know for others), it will help you to resize your browser in different resolutions for testing.
chrome : https://chrome.google.com/webstore/detail/web-developer/bfbameneiokkgbdmiekhjnmfkcnldhhm
firefox : https://addons.mozilla.org/fr/firefox/addon/web-developer/
You can also use web app to test your site at different screen resolutions.
http://whatismyscreenresolution.net/multi-screen-test
Go to tool to test website at different resolution , enter your site's url, and hit "test" button
Get the resolution of MacBook Air and enter it in the toobar.
This tool is really good and apart from testing your site for MacBook Air, you can also test it for different device resolutions

Browser doesn't scale below 400px?

I'm working on putting together a liquid style-sheet and it works wonderful. One thing that I've noticed is that my browser window in Chrome won't resize below 400px it just gets stuck there and in FF as I scale down it it just stops at around 400px and then pops a horizontal scroll bar.
When I open the site on my phone it looks perfect at around 320px, so I know it does scale lower than 400px.
I was curious if anyone knew if this was a browser/desktop thing or if I should be looking at something other than my CSS. I don't have any min-width declarations so i'm not sure what could be causing this.
Again on desktop it scales down to a min-width of about 400px and stops, but when I open it up on my phone it scales to the size of the phone screen which is roughly 320px... curious why at the very least it won't scale down to the 320px on desktop.
-edit-
Also I'm not sure if this matters but Opera allows it to scale down to pretty much nothing... So it works with Opera and not in Chrome or FF... any ideas?
Chrome cannot resize horizontally below 400px (OS X) or 218px (Windows) but I have a really simple solution to the problem:
Dock the web inspector to the right instead of to the bottom
Resize the inspector panel - you can now make the browser area really small (down to 0px)
Update: Chrome now allows you to arrange the inspector windows vertically when docked to the right! This really improves the layout.
The HTML and CSS panels fit really well and you even open a small console panel too.
This has allowed me to completely move from Firefox/Firebug to Chrome.
If you want to go a step further look at the web inspector settings (cog icon, bottom-right), and goto the user agent tab. You can set the screen resolution to whatever you like here and even quickly toggle between portrait and landscape.
UPDATE: Here is another really cool tool I've come across. http://lab.maltewassermann.com/viewport-resizer/
this may be because of the addons you installed on your browser. remove or hide all addon icons from the tool bar and try re size. when there are addons browser only resize the address bar and keeps the addons visible.
Update: 7/14/2013
With the latest chrome version, now you can re-size the address bar and it will hide the addons automatically.
I was stumped as well but ended up with a simple solution. I just created a HTML file with a link to open a new window:
Open!
This new window has nothing but the address bar and Chrome lets me freely resize this down to 111x80.
nayan9's solution works great, and can be put into a bookmark without having to create a html file. In Chrome, create a new bookmark with URL:
javascript:(function(){window.open('ANY_URL', '','width=320,height=480');})();
And give it a name of "Open Small Window" or something similar. This will allow you to easily open windows without size restrictions within chrome. Note that just copying this into your address bar won't work - chrome strips the "javascript:" out.
In case you want to reduce your screen width to emulate different devices (and why else would you want to do this?):
Chrome now has an Emulation section in its inspector, activated by clicking the little phone icon in the top menubar (between the magnifying glass and Elements):
Emulation mode allows you to set the viewport size to all common mobile screen sizes, among other nice features, like emulating touch, geolocation and even accelerometer input:
Adding to what nayan9 and drinkdecaf said, you can just throw document.URL into the call to window.open to see the page you're currently viewing in the 320 window. You might want to add some more to the width if you're expecting a scrollbar.
javascript:(function(){window.open(document.URL, '','width=320,height=480');})();
I am lazy, to make it even easier, let the bookmarklet ask the user for sizes :-D
javascript: (function() {var width = prompt('Enter window width:', '320');var height = prompt('Enter window height:','480');var url = prompt('Enter window URL');if (url.indexOf(':') < 0) {url = 'http://'+url;} window.open(url, '','width='+width+',height='+height);})()
in chrome the icons of your addons in the top right corner cause the problem
-> resize the adress-bar (where you type the urls) to maximum width (drag the bar at the right edge to the right)
or disable the icons
The DevTools in Chrome have moved on substantially from when most of these answers were posted. The best way to address this issue now is to use the emulators that are built into Chrome.
To use the emulators open DevTools (press F12) and then click on the following icon to toggle the Device Toolbar:
This will then allow you to emulate whichever mobile device or viewport size you want to.
I found a quick workaround for this.
Just install the Responsive Web Design Add-on to Chrome, and it will open a separate window without the address bar and tabs, which can be scaled down to 10 px or less.
Link here: https://chrome.google.com/webstore/detail/responsive-web-design-tes/bdpelkpfhjfiacjeobkhlkkgaphbobea/related
I've been experiencing similar issues and just found a good work around. Open up your chrome devtools and in the top left, there's a little screen and ipad icon. Click that and it opens a mobile view of your page. You can set it to predefined devices or a custom resolution. Pretty nifty actually.
Another easy solution is to click Strg+Shift+N to enter Incognito Mode. There you can resize your Browser window as you like.
I like this tool because it lets you switch quickly and also switches between portrait/horizontal easily for mobile sizes. It also allows you to make a personalized bookmark let, so if you design for obscure resolutions frequently, you can save them and use them.
I had to use one of these tools because even with the above answer I couldn't get my window to scale to 320 properly, this tool seems to be a faster solution overall.
http://lab.maltewassermann.com/viewport-resizer/
I'm always running into this issue with pinned tabs. Chrome will not resize below a horizontal width of eight visible pinned tabs if there are any! Just detach the tab that you want to resize to solve this ...
For a web developer, in order to test the responsiveness of their website in mobile or tablet whose size is less than 500px or minimum width then use developer tools to test in small screens.
For testing, go to developer tools and press ctrl+shift+M or click the device icon at the top left of the developer tools screen to toggle device mode. If the device icon is in blue colour, then you can test your website responsiveness by changing the browser window.
This is my first contribution to the Stack Overflow community, and it is my effort to give back to all you wonderful people who have made internet such a powerful tool.
Now to answer:
Safari, has this cool feature.
You need to activate safari developer option in preferences.
Screenshot of setting up preferences in Safari to activate developer menu
Once activated you can access bunch of very powerful developer tools.
One of this tool is Viewport adjustment which can used to test your website responsive layout.
To activate responsive lay out testing, one can use the shortcut Command+Ctrl+R
to activate safari view port adjustment option.
This will give you enough control to test your website on various view port sizes.
Screen shot of how your browser window will look once responsive layout test option is activated.
Link to how to activate developer menu in safari:
https://coolestguidesontheplanet.com/safari-web-developer-tools-show-dock-browser-window/
A lot of smart phones scale the page to fit into their screen size using zooming. Your minimum page width is probably 400px. Without any example code, I think that's all that can be said.