官术网_书友最值得收藏!

How to debug different viewports at the browser

Let's see how to debug different viewports using the Google Chrome web browser. Even if you already know that you can skip this section, it is important to refresh the steps for doing that.

First of all, open the current landing page project that we will continue working with in this chapter in the Google Chrome browser. In the page, you need to select the Developer tools option. There are many ways to open this menu:

  • Right-click at any place on the page and click on the last option Element inspector
  • Go to the setting (the sandwich button at the top-right of the address bar), click on More tools, and select Developer tools
  • The shortcut to open it is Ctrl + Shift + I (cmd for OS X users)
  • F12 in Windows also works (this is an Internet Explorer legacy)

In the Developer tools, click in the mobile phone on the left of a magnifier, as shown in the following screenshot:

How to debug different viewports at the browser

It will change the display of the viewport to a certain device and you can also set a specific network usage to limit the data bandwidth. Chrome will show a message telling you that for properly visualization you may need to reload the page to get the correct rendering.

How to debug different viewports at the browser

As shown in the next screenshot, we have activated the Device mode for an iPhone 5 device. When we set this viewport, problems started appearing because we did not make the landing page with mobile-first methodology.

How to debug different viewports at the browser

The first problem is in the second row of our layout. See how Ctrl + D breaks to a new line. That is not supposed to happen.

Another problem is that we have a horizontal scroll for this device due to some unknown reason. That sucks! We will have more work than with the opposite direction that starts with the mobile page. Keep it as a lesson for not repeating the same mistake.

Now, we can debug our website in different devices with different resolutions. You may see that the mouse cursor has changed to a gray circle. Also, the click actions have changed to tap actions. With that, you can fully test the website without the physical device.

Let's first clean out the messy parts in the layout before playing some tricks with the mobile version.

主站蜘蛛池模板: 唐河县| 晴隆县| 芦溪县| 旬邑县| 河曲县| 安图县| 襄樊市| 宝鸡市| 宿州市| 安西县| 盐边县| 伽师县| 普格县| 济阳县| 乌鲁木齐县| 集贤县| 六盘水市| 昆明市| 崇明县| 万州区| 玉门市| 望都县| 浮梁县| 许昌县| 玉屏| 苗栗市| 大丰市| 新宁县| 新泰市| 郑州市| 西青区| 宜良县| 赤峰市| 天水市| 扎赉特旗| 翁牛特旗| 辽源市| 措美县| 靖江市| 怀仁县| 湛江市|