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

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.

主站蜘蛛池模板: 杨浦区| 溧水县| 科尔| 秦安县| 大方县| 广元市| 诸城市| 阳曲县| 湟中县| 云梦县| 卓资县| 江永县| 景宁| 万年县| 广南县| 屯留县| 湘乡市| 琼结县| 石景山区| 阿尔山市| 章丘市| 江北区| 永吉县| 高碑店市| 万宁市| 新沂市| 高淳县| 维西| 怀来县| 浦城县| 汾西县| 通辽市| 元江| 达州市| 高密市| 隆安县| 青川县| 葫芦岛市| 乐亭县| 中江县| 大埔县|