Loading

T3 Browser DevTools · Lesson 7

Device mode

Testing for phones from a laptop: the device toolbar, what it changes and what it cannot, designing for fingers with hover and pointer queries, the Sensors panel and other people's eyes, and debugging on a real phone.

  • use the device toolbar to test a page at any size, and find where a layout breaks
  • say what device mode changes, and what it cannot
  • design for fingers: hover, tap targets and pointer queries
  • set a location and an orientation, and see a page through other eyes
  • debug a page on a real phone, and choose what to test before a page goes out
About 60 minutesChecked against Google Chrome on the laptop (the kit renders every HTML block in it, and the DevTools step describes its panels) 155 (2026-11-06)Play this lesson's games

The back cover

Most visitors will meet your page on a phone, in one hand, on a slower network, with a thumb instead of a mouse. Your laptop shows none of that. A page that is perfect on a wide screen can still fail every one of them.

These pages show the device toolbar, which turns one window into any screen. They show what its pretending changes and what it cannot, and how to design for fingers with hover and pointer queries. They try other places and other people's eyes with the Sensors panel and the Rendering tab. They end where the pretending stops, on a real phone.

Before you start

The story: A hundred glasses on one bench

The Harbour Office wants its new panel on the great glass at the quay, on the ferries, and on the pocket glasses its pilots carry. Corin has borrowed eleven glasses of different shapes, and covered the bench with them. One has a crack across the corner. He is running out of hands.

Ottilie Sen moves two of them gently aside, and sets down the last lens, the plainest of the seven.

"You cannot own every glass in Brasshaven," she says. "This one can pretend to be any of them. Use it all you like. But remember that it is pretending."

Most of your visitors hold a phone, and you build on a laptop. You cannot own every phone in India, and you need not, at least to begin with. The last tool on this bench lets one laptop pretend to be any screen, with its size, its touch, its speed and even its location. It also tells you where the pretending stops. It builds on these ideas; each has a tiny example.

What you already knowA tiny exampleWhere it comes back
The viewport meta tag.A phone uses its real width.The toolbar obeys it, as a phone does.
Media queries.@media (min-width: 600px)The toolbar shows where they change.
Device pixel ratio.2 dots in each CSS pixel.You can set it.
Orientation.(orientation: landscape)One click turns the screen.
Hover and focus.button:hoverA finger does not hover.
Throttling.CPU and network slowdowns.The toolbar holds them too.
The Rendering tab.Paint flashing.It can also show the page through other eyes.
A contrast of 4.5 to 1.Dark grey on white passes.Bright sun is harder still.

By the end of this lesson you will be able to:

  • use the device toolbar to test a page at any size, and find where a layout breaks;
  • say what device mode changes, and what it cannot change;
  • design for fingers: hover, tap targets and pointer queries;
  • set a location and an orientation, and see a page through other eyes;
  • debug a page on a real phone, and choose what to test before a page goes out.

How to follow this lesson

The notes under each block say what the kit measured, in a window of a stated size, or in a phone's window with real taps. Press Ctrl + Shift + M to turn the device toolbar on, and press Run on a block to see the same thing yourself.

In one line

Device mode lets a laptop pretend to be a phone, in size, touch, speed and location; you need media queries, the viewport tag and the idea of hover.

One screen, any size: the device toolbar

At a glance

A tailor's dummy can be set to any size with a few turns of a screw, so one dummy stands in for many customers. The device toolbar does that for a browser window. Press Ctrl + Shift + M, or Cmd + Shift + M on a Mac, to turn it on.

Choose a phone from the list, or drag the frame to any width. Show media queries draws your breakpoints as bars above the page, and the rotate button turns the screen sideways. Then drag slowly from narrow to wide and watch for the width where something breaks.

Take a guess: How do you find the exact width at which a layout breaks?

A tailor's dummy can be set to any size with a few turns of a screw, so that one dummy stands in for many customers. The device toolbar does that for a browser window.

device mode

A set of DevTools features that imitate a phone or tablet on your laptop: its screen size, its touch input, and a slower CPU and network. The device toolbar is how you control them.

Press Ctrl + Shift + M, or Cmd + Shift + M on a Mac, with DevTools open, or click the phone and tablet button at the top left of DevTools. The page shrinks into a frame, and a bar appears above it.

In the barWhat it does
DimensionsResponsive, for any size, or a named phone or tablet
width and height boxestype an exact size
the handles on the framedrag to resize, and watch the page change
Zoomfit the frame on your screen; it changes nothing on the page
ThrottleMid-tier mobile or Low-end mobile: a slower network and CPU together
Rotateswap the width and height
the three dotsmore: media queries, rulers, device pixel ratio, device type, screenshots

Under the bar, the width presets are one click away: 320, 375 and 425 pixels for phones, then 768 for a tablet and 1024 for a laptop. Many low-priced phones in India are 360 wide, so type that one too.

Seeing your breakpoints

Open the three dots, and choose Show media queries. Coloured bars appear above the page, one for each query in the sheet. Click a bar, and the frame jumps to that width. It is the quickest way to check each layout of a page. Show rulers adds a pixel scale, and Capture screenshot saves what you see.

Reloading after you switch

Some pages decide things once, as they load. After you change a device, reload, so that the page starts as it would on that phone.

A memory aid

Ctrl + Shift + M, then drag slowly from narrow to wide. The moment something breaks is your next breakpoint.

Worked example 1

A shop's menu looks fine on your laptop and on a 375 pixel phone. A customer with a small phone says that the page scrolls sideways. Find the width where it breaks, and fix it.

What we have: three links of 120 pixels in a flex row

What we need: the width where the page overflows, and a fix

The plan: set the toolbar to Responsive, and narrow it until the page gets wider than the frame

  1. Three links of 120 make 360 pixels, so the row fits in 375.
  2. Narrow the frame to 320, the smallest preset. The row sticks out, and the page scrolls sideways.
  3. Let the row wrap, so that the third link moves to a new line on small screens.
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  .bar { display: flex; }
  .bar a { flex: none; width: 120px; }
</style>
<div class="bar">
  <a href="#home">Home</a>
  <a href="#offers">Offers</a>
  <a href="#cart">Cart</a>
</div>

Checked in Chrome

  • at 375: the row fits, and the page is 375 wide
  • at 320: the row sticks out, and the page is 360 wide: it scrolls sideways
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  .bar { display: flex; flex-wrap: wrap; }
  .bar a { flex: none; width: 120px; }
</style>
<div class="bar">
  <a href="#home">Home</a>
  <a href="#offers">Offers</a>
  <a href="#cart">Cart</a>
</div>

Checked in Chrome

  • at 320: with wrapping, the page is 320 wide, and nothing sticks out

It breaks below 360 pixels. flex-wrap: wrap lets the links move to a new line.

Check: the page's width read 360 at 320 pixels before the fix, and 320 after it.

When you are stuck: the device toolbar

No toolbar: DevTools must be open and in focus; click inside it, then press Ctrl + Shift + M.

A control is missing: the bar hides what does not fit; widen DevTools, or look under the three dots.

The page looks like a tiny desktop page: the viewport meta tag is missing, and the toolbar shows that faithfully.

Your turn

Which shortcut turns device mode on?Tap to reveal
  1. M for mobile.

Ctrl + Shift + M.

How do you see where a sheet's media queries change?Tap to reveal
  1. The three dots.

Show media queries.

Does Zoom in the toolbar change the page's layout?Tap to reveal
  1. It only fits the frame.

No.

Did you know?

Why 320 pixels

Accessibility guidelines give a narrow width to test. WCAG 2.2 asks that content can be used without scrolling in two dimensions at a width equal to 320 CSS pixels. Its note explains the number: 320 CSS pixels is what a window 1280 CSS pixels wide becomes at 400% zoom. So a page that works at 320 serves small phones and people who zoom in alike.

Why it fits here: When you drag the frame narrow, go down to 320 at least: that is the width at which WCAG asks the page to reflow.

Source: W3C: WCAG 2.2

Blue bars and orange bars

The bars of Show media queries have a colour code. The blue bar holds the max-width breakpoints, and the orange bar the min-width ones. Click between breakpoints, and the viewport changes width so that the breakpoint is triggered. Right-click between breakpoints and choose Reveal in source code, and the Sources panel opens at the @media rule.

Why it fits here: It turns this topic's slow drag into a quick check: click each band in turn, and look at the page at each breakpoint.

Source: Chrome for Developers: Simulate mobile devices with device mode

In one line

The device toolbar turns the window into any screen: choose a phone or drag the frame, show the media queries, and rotate. Press Ctrl + Shift + M, and drag slowly from narrow to wide to find what breaks.

What the pretending changes

At a glance

An actor playing a doctor wears the coat and uses the words, and cannot operate. Device mode is good at the costume. It helps to know exactly which parts it can play.

It changes the viewport's size, the device pixel ratio, touch input and the user agent, and it can slow the CPU and the network if you ask. Width says nothing about fingers, though. To ask how a person is touching the page, use (hover: none) and (pointer: coarse), and test short screens too.

Take a guess: Does a narrow screen tell you that the visitor is using a finger?

An actor playing a doctor wears the coat and uses the words, and cannot operate. Device mode is good at the costume. It helps to know exactly which parts it can play.

It changesSo that
the viewport's sizeyour media queries and layouts respond
the device pixel ratiothe browser picks images as a phone would
touch inputyour pointer acts as a finger: a tap, a drag to scroll
hover and pointer queries(hover: none) is true
the user agenta named device reports itself as that device
CPU and network, if you askthe page runs slower

This block writes down what the page can see. Run it with the toolbar off, then on.

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<p class="out"></p>
<script>
  document.querySelector(".out").textContent = innerWidth + " wide, " + devicePixelRatio + " dots per pixel";
</script>

Checked in Chrome

  • in the kit's usual window: 800 wide, 1 dot per pixel
  • in the phone's window: 375 wide, 2 dots per pixel
  • on its side: 667 wide

Asking how a person is touching the page

Width says nothing about fingers: a tablet can be as wide as a laptop. Two media features ask the real question.

FeatureTrue whenLaptop with a mousePhone
(hover: hover)the main pointer can rest over thingsyesno
(hover: none)it cannotnoyes
(pointer: fine)the main pointer is exact, as a mouse isyesno
(pointer: coarse)the main pointer is rough, as a finger isnoyes
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  .mouse, .finger { display: none; }
  @media (hover: hover) { .mouse { display: block; } }
  @media (hover: none) { .finger { display: block; } }
</style>
<p class="mouse">Hold the pointer over a stall to see its price.</p>
<p class="finger">Tap a stall to see its price.</p>

Checked in Chrome

  • with a mouse, the page speaks of the pointer
  • on the phone, it speaks of tapping

Worked example 2

A shop's app has a 100 pixel header and an 80 pixel footer. On a phone held upright it looks fine. Turned on its side, the content is squeezed into a slot. Measure it, and fix it for short screens.

What we have: a header of 100 and a footer of 80, in a window 667 tall, then 375 tall

What we need: the height left for the content, and a fix

The plan: rotate in the toolbar, and read the main box's height; then shrink the bars on short, wide screens

  1. Upright: 667 − 100 − 80 = 487 pixels for the content.
  2. On its side: 375 − 100 − 80 = 195 pixels, well under half of that.
  3. Shrink the bars for short screens only, with a query on height: (orientation: landscape) and (max-height: 500px).
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  .app { display: grid; grid-template-rows: 100px 1fr 80px; height: 100vh; }
</style>
<div class="app">
  <header>Asha Stores</header>
  <main>Today's offers</main>
  <footer>Home | Cart</footer>
</div>

Checked in Chrome

  • on the phone: 487 for the content
  • on its side: only 195
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  .app { display: grid; grid-template-rows: 100px 1fr 80px; height: 100vh; }
  @media (orientation: landscape) and (max-height: 500px) {
    .app { grid-template-rows: 48px 1fr 40px; }
  }
</style>
<div class="app">
  <header>Asha Stores</header>
  <main>Today's offers</main>
  <footer>Home | Cart</footer>
</div>

Checked in Chrome

  • on the phone: 487, as before
  • on its side: 375 − 48 − 40 = 287

195 pixels, then 287. A query on height gives the short screen its room, and the upright layout stays as it was.

Check: the main box measured 195, then 287, on its side, and 487 upright both times.

When you are stuck: what device mode changes

The page does not respond to the phone's width: is the viewport tag there?

Hover styles still show as you move the pointer: choose a phone, or set the device type to Mobile.

A height query does nothing: remember to rotate; the width has not changed unless you do.

Your turn

Which feature is true on a phone: (hover: hover) or (hover: none)?Tap to reveal
  1. A finger cannot rest.

(hover: none).

A tablet is as wide as a laptop. How do you tell that it uses a finger?Tap to reveal
  1. Rough or exact?

(pointer: coarse).

A phone is 360 by 740. How wide is it on its side?Tap to reveal
  1. Swap them.

740.

Did you know?

An iPad that says it is a Mac

Some real devices pretend too. With Safari 13 in 2019, WebKit brought a desktop-class browsing experience to the iPad. With the exception of the iPad mini, Safari on iPad began to send a user-agent string identical to Safari on macOS. So a site that checks the user agent sees a Mac, though a finger is touching the screen.

Why it fits here: It is the strongest reason for this topic's rule: ask about the pointer and hover, because the user agent can say Mac on a touch screen.

Source: WebKit: New WebKit Features in Safari 13

Every Android is Android 10

The user agent now tells less than it used to. Under Chrome's User-Agent Reduction, Chrome on Android sends one frozen platform part, Linux; Android 10; K, whatever the phone. The project notes that these strings are literal values, which will not update even on an updated system or device. So a page cannot read the phone's model from the user agent any more.

Why it fits here: It is why this topic asks with hover and pointer queries: the user agent no longer says which phone it is.

Source: The Chromium Projects: User-Agent Reduction

In one line

Device mode changes the viewport, the pixel ratio, touch, the user agent, and speed if you ask. Width says nothing about fingers, so ask with (hover: none) and (pointer: coarse), and test short screens too.

A finger is not a pointer

At a glance

A mouse pointer is a sharp point that can rest over a thing without choosing it. A finger is a broad pad that arrives suddenly, hides what it touches, and leaves. Pages built with a mouse often forget this.

A phone fakes hover at a tap, and the hover state then sticks. So keep hover styles inside @media (hover: hover), and never hide something that matters behind hover alone. Give touch targets about 48 pixels each way, using (pointer: coarse) to make them larger on touch screens.

Take a guess: Why can a hover menu stay open on a phone after you tap it?

A mouse pointer is a sharp point, always on the screen, that can rest over a thing without choosing it. A finger is a broad pad that arrives suddenly, hides what it touches, and leaves. Pages built with a mouse often forget this.

A mouseA finger
size of the pointone pixelabout the width of a large button
can rest over somethingyesno
hides what it touchesnoyes
shows where it is before actingyesno
can right-clickyesa long press, on some things

Hover on a touch screen

A phone has no hovering, so to keep older sites working it fakes it: a tap also sets the hover state. A menu that opens on hover does open at a tap. The trouble comes afterwards, because the state stays on after the finger has gone.

With a real tap, in a phone's window

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  button { height: 48px; background-color: lightgrey; }
  button:hover { background-color: gold; }
</style>
<button id="buy">Buy</button>
<p id="other" style="margin-top: 100px">Elsewhere</p>
<script>
  function report(when) {
    const lit = getComputedStyle(document.querySelector("#buy")).backgroundColor === "rgb(255, 215, 0)";
    console.log(when, lit ? "lit" : "plain");
  }
  document.querySelector("#buy").addEventListener("click", function () { setTimeout(function () { report("after the tap:"); }, 20); });
  document.querySelector("#other").addEventListener("click", function () { setTimeout(function () { report("after a tap elsewhere:"); }, 20); });
</script>

On a phone, this page logged

after the tap: lit
after a tap elsewhere: plain

The button was tapped, and it stayed gold after the finger left, looking as if it were still selected, until the next tap somewhere else. This is known as sticky hover. To a visitor, the button seems stuck. The cure is to keep hover styles for screens that can really hover.

The hover style kept for real pointers

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  button { height: 48px; background-color: lightgrey; }
  @media (hover: hover) {
    button:hover { background-color: gold; }
  }
</style>
<button id="buy">Buy</button>
<p id="other" style="margin-top: 100px">Elsewhere</p>
<script>
  function report(when) {
    const lit = getComputedStyle(document.querySelector("#buy")).backgroundColor === "rgb(255, 215, 0)";
    console.log(when, lit ? "lit" : "plain");
  }
  document.querySelector("#buy").addEventListener("click", function () { setTimeout(function () { report("after the tap:"); }, 20); });
  document.querySelector("#other").addEventListener("click", function () { setTimeout(function () { report("after a tap elsewhere:"); }, 20); });
</script>

On a phone, this page logged

after the tap: plain
after a tap elsewhere: plain

Hover has a second weakness. Anything shown only on hover, such as a tooltip or the name of an icon, has no way of being discovered on a phone. Nothing tells a visitor to tap there. Put what matters on the page.

A memory aid

Hover is a bonus, never the only way. Keep it in @media (hover: hover).

Room for a finger

A link that is easy to click with a mouse can be a misery to tap. Web accessibility guidelines ask for at least 24 by 24 CSS pixels, and most design guides suggest about 48. Give small targets more room on touch screens, with a coarse-pointer query, so that desktop layouts stay tight.

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  a { font-size: 12px; }
  @media (pointer: coarse) {
    a { display: inline-block; min-width: 48px; min-height: 48px; }
  }
</style>
<a href="#help">Help</a>

Checked in Chrome

  • with a mouse: the link stays small, under 20 tall
  • on the phone: 48 by 48, room for a finger

Worked example 3

A shop's Buy button turns gold on hover. Customers on phones complain that it looks stuck after they tap it. Reproduce it, and fix it, keeping the hover for mouse users.

What we have: a button with a hover style, and a report from phones

What we need: the state after a tap, and a rule that avoids it

The plan: turn on device mode, tap, and watch; then guard the hover with (hover: hover)

  1. With the toolbar on, click the button: your click acts as a tap. It stays gold.
  2. In the Styles tab, the rule button:hover is still active, though no finger is there.
  3. Wrap the rule in @media (hover: hover). On a phone it no longer applies, and a mouse still gets the gold.
  4. To show the press on a phone, button:active applies only while the finger is down.

Wrap the hover rule in @media (hover: hover). The state no longer sticks, and desktop users lose nothing.

Check: with real taps, the button read lit before the change, and plain after it.

Worked example 4

A shop's footer has a small Help link in 12 pixel text. Customers on phones keep tapping the words beside it. Measure the link, and give it room on touch screens only.

What we have: a small link, and a report from phones

What we need: its real size, and a rule for fingers

The plan: inspect it in device mode and read the box model; then add a coarse-pointer query

  1. Inspect the link. The box model reads about 14 tall: far under the 24 that guidelines ask for.
  2. A larger link would upset the footer on a laptop, so make it larger for fingers only.
  3. An inline link takes no height, so give it display: inline-block inside the query as well.
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; font-size: 12px; }
  @media (pointer: coarse) {
    .help { display: inline-block; min-height: 48px; min-width: 48px; }
  }
</style>
<footer>Open 9 to 9. <a class="help" href="#help">Help</a></footer>

Checked in Chrome

  • with a mouse: the link stays under 20 tall, and the footer is unchanged
  • on the phone: 48 tall, with room for a finger

About 14 pixels tall, then 48 on touch screens. The query leaves the laptop's footer as it was.

Check: the link measured under 20 with a mouse, and 48 in the phone's window.

When you are stuck: touch

A style stays on after a tap: it is a hover style; guard it with (hover: hover).

A link is hard to tap: inspect it in device mode, and read its size in the box model.

Something can be reached only by hovering: put it on the page, or open it with a tap.

Your turn

What does a tap do to the hover state on a phone?Tap to reveal
  1. It fakes it.

It sets it, and it stays until a tap elsewhere.

How large should a touch target be?Tap to reveal
  1. About the width of a fingertip.

About 48 by 48 pixels, and at least 24.

Which query keeps hover styles for real pointers?Tap to reveal
  1. Can it rest?

@media (hover: hover).

Did you know?

How big is a finger?

Standards and guides put numbers on a finger. WCAG 2.2 sets a minimum target size of 24 by 24 CSS pixels at level AA, and an enhanced size of 44 by 44 at level AAA. Google's web.dev recommends around 48 device independent pixels: a 48 by 48 area is about 9 mm, about the size of a finger pad. Targets should also be about 8 pixels apart.

Why it fits here: It is where this topic's 48 pixels comes from, and why the WCAG minimum of 24 is a floor, not a goal.

Sources: W3C: WCAG 2.2; web.dev: Accessible tap targets

The inconvenient long tap

Phones do not lack hover by accident. MDN describes hover: none as a primary input that cannot hover at all, or cannot conveniently hover. Many mobile devices, it adds, emulate hovering when the user performs an inconvenient long tap. The Media Queries standard's own example uses @media (hover) to show a hover-activated drop-down menu only on devices that can conveniently hover.

Why it fits here: It is the reason for this topic's rule: on a phone, hover is a bonus, never the only way to reach something.

Sources: MDN: hover; W3C: Media Queries Level 4

In one line

A phone fakes hover at a tap, and the state sticks, so keep hover styles inside @media (hover: hover), and never hide what matters behind hover. Give touch targets about 48 pixels with (pointer: coarse).

Other places, other eyes

At a glance

A site that shows the nearest shop must be tested in many cities, and nobody will fly you to them. Two more tools let you pretend about the world and about the visitor.

The Sensors panel sets a location, from a preset city to your own coordinates or location unavailable, and it sets the phone's orientation. The Rendering tab imitates dark mode, reduced motion, print, and the eyes of people with low or different colour vision. Test the case where the answer is no as well.

Take a guess: How can you test a page that needs a location without leaving your chair?

A site that shows the nearest shop must be tested in many cities, and nobody will fly you to them. Two more tools let you pretend about the world and about the visitor.

The Sensors panel

Press Ctrl + Shift + P, type sensors, and choose Show Sensors. A tab opens in the Drawer.

SettingWhat it doesTest it for
Locationsets a preset city, your own coordinates, or Location unavailablepages that use where the visitor is
Orientationtilts the device, by presets or exact anglespages that respond to a phone being turned
Touchforces touch input on or offpages that test for touch
Emulate Idle Detector statepretends that the visitor is awaypages that notice being left alone

Worked example 5

A delivery site shows the nearest shop. Test it for a visitor in Pune, and for a visitor who refuses to share their location.

What we have: a page that asks for the location, and two cases to test

What we need: what the page does in each

The plan: set Custom location in the Sensors panel for one, and Location unavailable for the other

  1. Set a custom location of 18.52, 73.86, and reload. The page reads Pune's coordinates.
  2. Set Location unavailable, and reload. Now the page must cope with having no answer.
  3. The second function passed to getCurrentPosition runs when there is no location. A page with no such function is left waiting for ever.

With a location set

<!DOCTYPE html>
<script>
  navigator.geolocation.getCurrentPosition(
    function (pos) {
      console.log("nearest shop to", pos.coords.latitude, pos.coords.longitude);
    },
    function () {
      console.log("Please choose your city");
    }
  );
</script>

On a phone, this page logged

nearest shop to 18.52 73.86

With no location allowed

<!DOCTYPE html>
<script>
  navigator.geolocation.getCurrentPosition(
    function (pos) {
      console.log("nearest shop to", pos.coords.latitude, pos.coords.longitude);
    },
    function () {
      console.log("Please choose your city");
    }
  );
</script>

On a phone, this page logged

Please choose your city

Test both. Pune gives the coordinates, and refusing runs the second function, which asks for a city.

Check: the same page logged the coordinates in one run, and the question in the other.

The Rendering tab's emulations

You have used this tab to emulate dark mode and less motion. It can also imitate a printer, and imitate other people's eyes.

EmulationWhat it shows
prefers-color-schemeyour dark theme, with no change to your settings
prefers-reduced-motionyour page for a visitor who asked for less motion
printthe page as it will print, with your print rules
Emulate vision deficienciesblurred vision, reduced contrast, and kinds of colour blindness

Open the tab, and choose Blurred vision: this is close to what many older visitors see without their glasses. Then choose Protanopia or Deuteranopia, and look for anything that relies on red against green alone. A form that marks errors only in red may say nothing at all to one man in twelve.

A memory aid

Change the place, change the eyes, and look again.

When you are stuck: sensors and emulation

A page asks for a location and nothing happens: the site may have been refused earlier; click the icon beside the address, and reset the permission.

A setting seems to do nothing: the Sensors tab acts only while DevTools is open; reload the page.

Print rules cannot be checked by printing: choose print in the Rendering tab.

Your turn

Which panel sets a false location?Tap to reveal
  1. It holds the device's sensors.

The Sensors panel.

How do you check a page for red and green alone?Tap to reveal
  1. The Rendering tab.

Emulate vision deficiencies, such as Deuteranopia.

What must a page have for a visitor who refuses their location?Tap to reveal
  1. The second function.

An error path that still lets them go on.

Did you know?

One man in twelve

Colour vision deficiency is common. Colour Blind Awareness puts it at about 1 in 12 men and 1 in 200 women. Wikipedia gives red-green deficiency as 8% of males and 0.5% of females of Northern European descent. To help you see what they see, Chrome 83 added Emulate vision deficiencies to the Rendering tab, with blurred vision among its choices.

Why it fits here: A red-only error message fails about one man in twelve; this topic's emulation shows that failure before a visitor meets it.

Sources: Colour Blind Awareness: About colour blindness; Wikipedia: Color blindness; Chrome for Developers: What's New In DevTools (Chrome 83)

Motion that makes people ill

Reduced motion is a medical need for some people. Apple added a Reduce Motion switch to iOS 7, and in May 2017 WebKit added the prefers-reduced-motion media feature, so that pages can follow it. The WebKit post explains why: the change is required for some people with vestibular disorders. These are caused by problems affecting the inner ear and the parts of the brain that control balance.

Why it fits here: It is why this topic tests the Rendering tab's reduced motion: for some visitors, an animation is not decoration but a cause of sickness.

Source: WebKit: Responsive Design for Motion

In one line

The Sensors panel sets a location and an orientation, and the Rendering tab imitates dark mode, less motion, print and other people's eyes. Test the case where the answer is no as well.

Where the pretending stops

At a glance

Chrome's own guide calls device mode a first-order approximation of how a page looks and feels on a phone. It runs on your laptop's CPU, in your laptop's Chrome. It is excellent for layout, and it catches most problems early.

It cannot show how a page feels in the hand, the on-screen keyboard, or a slow phone's real speed. So use device mode on every change, and test on a real, low-priced phone before a page goes out. Remote debugging puts the whole of DevTools on that phone.

Take a guess: Which problems can only a real phone show you?

Chrome's own guide calls device mode a first approximation of how a page looks and feels on a phone. It runs on your laptop's CPU, in your laptop's Chrome. It is excellent for layout, and for catching most problems early. It cannot do everything.

Device mode shows wellOnly a real phone shows
layouts and breakpointshow it feels in the hand, and whether a thumb can reach
touch events and sticky hoverreal scrolling, and how a finger hides the screen
images by pixel ratiothe real sharpness of the screen
a rough idea of speedtrue speed: a phone's chip differs in kind, not only in speed
a location and a tiltthe real keyboard, and how it covers your form
bright sun, a cracked screen, and a browser that is not Chrome

A memory aid

Device mode for every change. A real phone before it goes out.

Debugging a real phone from your laptop

Remote debugging connects your laptop's DevTools to Chrome on an Android phone. Everything in this step, the Elements panel, the Console and the rest, then works on the phone itself, on a real chip and a real network.

StepDo this
1On the phone, open Developer Options, and turn on USB debugging
2On the laptop, open chrome://inspect#devices in Chrome
3Tick Discover USB devices, and connect the phone with a USB cable
4Accept the prompt on the phone
5Open your page in Chrome on the phone
6On the laptop, click Inspect beside that page

Developer Options is hidden at first: on most Android phones, tap the Build number in Settings, under About phone, seven times. For an iPhone, the same work is done with Safari on a Mac.

A short list before a page goes out

CheckHowLooking for
small and largedrag from 320 to 1440 in device modeoverflow, and awkward gaps
on its sideRotateshort screens
with a fingerdevice mode, and tap everythingsticky hover, small targets
on a poor connectionLow-end mobilethe wait, and what shows first
as a new visitoran Incognito windowfirst-visit bugs
with less motion, in dark modethe Rendering tabyour care for those visitors
with other eyesEmulate vision deficienciesmeaning carried by colour alone
in the handa real, low-priced phoneeverything else

Worked example 6

A shop's sign-up form works in device mode at every width. On a real phone, a customer says that the Submit button cannot be reached. What could device mode not show, and how do you find out?

What we have: a form that passes in device mode, and fails on a phone

What we need: what differs, and a way to see it

The plan: a real phone has an on-screen keyboard, which device mode does not bring up; debug on the phone

  1. Device mode imitates the screen, and it does not raise the phone's keyboard, which can cover half of it.
  2. Connect a real phone, and open chrome://inspect#devices.
  3. Tap the last field, then use Inspect on the laptop, and look at the page while the keyboard is up.
  4. The button sits behind the keyboard, inside a box that does not scroll. Letting that box scroll cures it.

The on-screen keyboard. Device mode does not raise it, and remote debugging lets you study the real page with it open.

Check: after the fix, on the same phone, the field and the button can both be reached with the keyboard up.

When you are stuck: real phones

The phone does not appear: check the cable carries data, and accept the prompt on the phone.

You have no Android phone: borrow one, as a low-priced phone is the best test of all.

It works on your phone and not on theirs: ask for the browser, its version, and the phone's width.

Your turn

Why is a real phone's speed different from a 4x slowdown?Tap to reveal
  1. A phone's chip.

A phone's chip differs in kind, not only in speed.

Where do you connect to a real Android phone?Tap to reveal
  1. An address in Chrome.

chrome://inspect#devices.

Name one thing device mode cannot show you.Tap to reveal
  1. Think of the sun.

Bright sun, the real keyboard, or how it feels in the hand.

Did you know?

Seven taps

Remote debugging starts with a hidden menu. On an Android phone, Developer options stay hidden until you tap the Build number entry seven times, when the phone says: You are now a developer! There you select Enable USB Debugging. Then, with the phone joined to your laptop by a USB cable, chrome://inspect#devices in Chrome finds it.

Why it fits here: It is the first step of this topic's real-phone test: after it, every panel of this track works on the phone itself.

Sources: Android Developers: Configure on-device developer options; Chrome for Developers: Remote debug Android devices

DevTools is a web app

The tool used through this whole track is itself a web app. The repository of the Chrome DevTools frontend says that it contains the client side of Chrome DevTools: all the TypeScript and CSS code that runs the DevTools web app. So the panels you have learnt are built from the same kinds of code as the pages they inspect.

Why it fits here: It closes the track with a thought worth keeping: nothing in DevTools is magic; it is a web app that you could read.

Source: GitHub: ChromeDevTools/devtools-frontend

In one line

Device mode is a first approximation: use it on every change, then test on a real, low-priced phone before a page goes out. Remote debugging puts the whole of DevTools on the phone.

Where it is used

Nearly all front-end work now passes through this toolbar, since most visits arrive on a phone.

What you learnedWhere it is usedA real example
the device toolbardaily layout workdragging a page from narrow to wide while writing its CSS
Show media querieschecking breakpointsvisiting each layout of a shop's home page in turn
hover and pointer queriesbuttons and menusa menu that opens on a tap and on a hover
touch targetsforms and listsa list of orders that a thumb can use
the Sensors panelpages that use locationtesting a food app for a city you have never visited
vision emulationsaccessibility checksfinding a chart that relies on red against green
remote debuggingbugs that only phones showwatching the Console of a customer's model of phone

Mistakes and debugging

These are the slips everyone makes with device mode.

1. Testing only your own phone's width

A page that fits 412 may break at 360. The fix: drag slowly from 320 upwards.

2. Forgetting to rotate

A layout that fills an upright phone may leave a slot on its side. The fix: Rotate is one click.

3. Not reloading after a switch

Code that ran at load still thinks that it is on a laptop. The fix: reload after you change the device.

4. Trusting it for speed

A 4x slowdown on a fast laptop is not a low-priced phone. The fix: measure on a real one when speed matters.

5. Hover as the only way

Something shown only on hover cannot be discovered with a finger. The fix: put it on the page.

6. Choosing by width to find touch

A small laptop window is narrow, and a large tablet is wide. The fix: ask (pointer: coarse), not the width.

7. Leaving the toolbar on

You open your site and it looks wrong, because the toolbar, a slowdown or a false location is still on. The fix: switch them off when you have finished.

The debugging corner: all the lenses together

Most real faults cross panels. Turn on device mode, open the Console in the Drawer with Esc, and throttle the network. Now you are a visitor on a phone on a slow connection, with every message in view. That is the closest a laptop comes to standing in your visitor's shoes.

Quick card

The lesson on one card.

Every idea of the lesson

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
  body { margin: 0; }
  .bar { display: flex; flex-wrap: wrap; }
  .bar a { width: 120px; }
  button { background-color: lightgrey; }
  @media (hover: hover) {
    button:hover { background-color: gold; }
  }
  @media (pointer: coarse) {
    button { min-width: 48px; min-height: 48px; }
  }
</style>
<div class="bar">
  <a href="#home">Home</a>
  <a href="#offers">Offers</a>
  <a href="#cart">Cart</a>
</div>
<button>Go</button>

Checked in Chrome

  • in the usual window, nothing sticks out
  • and the hover style is in use
  • at 320: the links wrap, and nothing sticks out
  • on the phone, there is no hover
  • on the phone: and the button is 48 tall for a finger
  • on its side: 667 wide
To do thisDo this
device mode on or offCtrl + Shift + M
any sizeResponsive, then drag or type
see the breakpointsthe three dots, Show media queries
turn the screenRotate
act like a slow phoneThrottle: Mid-tier or Low-end mobile
keep hover for pointers@media (hover: hover)
room for fingers@media (pointer: coarse)
set a locationthe Sensors panel
other eyesthe Rendering tab, Emulate vision deficiencies
a real phonechrome://inspect#devices

And here is the whole bench, the seven lenses of this step, on one table.

The questionThe panelStart with
why does it look wrong?ElementsInspect; is the rule crossed out?
why does it not work?Consolethe first red line
what arrived, and what did not?Networkopen, reload, read the Status column
what is the code really doing?Sourcesa breakpoint, then read the Scope
what does it remember?Applicationthe five stores
why is it slow?Performancethe three numbers, then record
what is it like on a phone?device modeCtrl + Shift + M

And the rule of the whole Row: look first, guess afterwards.

The story: Walked, and not yet steady

The panel shrinks to a pilot's glass, turns on its side, and answers to a fingertip. A button that glows under a pointer stays lit after the finger has gone, so you keep that glow for glasses that have a pointer. Then you carry a real glass down to the quay, and find what no lens could show: in the sun, the pale grey words cannot be read.

Ottilie closes the seven lenses in their case and hands it to you. Back at the shop, Ilse writes a line beside your name in the apprentices' book: the four halls of the Ninth Circle, walked.

"Walked is not steady," she says. "Show me the practice."

Reagents gathered: device toolbar, device pixel ratio, hover, pointer, Sensors, remote debugging.

Sources

  • Chrome DevTools documentation (Page content CC BY 4.0, code samples Apache 2.0 (the footer of its pages, read 2026-11-06); reused with credit)
  • MDN Web Docs (Prose CC BY-SA 2.5 or later; code samples added since 2010-08-20 CC0 (its licensing page, read 2026-10-26); reused with credit)