Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome developer tools window dimensions are inconsistent

When you have the Chrome developer tools open, and you resize the window, a small white box appears in the top right corner telling you the dimensions of the window as you resize it. I've marked it with a big green arrow in the screenshot below.

This is a very useful tool, but I've noticed that frequently the values are unexpected and inconsistent with the widths of other elements. For example, when I took the screenshot below, Chrome says the window width is 419px. But if I click the html elements, whose width should be 100%, Chrome tells me its width is 404px. This is confusing to me. Why are they different? Is this a bug in Chrome?

Chrome developer tools window size indicator

like image 467
emersonthis Avatar asked Mar 05 '14 17:03

emersonthis


People also ask

How do I fix Chrome developer tools?

# Open the Issues tabOpen DevTools. Click the Go to Issues button in the yellow warning bar. Alternatively, select Issues from the More tools menu. Once you're on the Issues tab, click the Reload page button if necessary.

How do I change screen size in dev tools?

Open Chrome Developer Tools. Click the Toggle Device Mode option near top left of the developer tools section. Choose Responsive from the dropdown menu at the top of the screen. Edit the dimensions, which are also at the top of screen, right next to the dropdown.

How do I check my chrome width?

You'll notice dotted lines appearing around elements on your page. Find the content area and click to focus on it. Back in the bottom window, click Box Model on the right. The width and height will be shown.

How to show viewport width when resizing window in Chrome Developer Tools?

Show viewport width when resizing window in Chrome developer tools? I use Chrome with developer tools docked to the right hand side of the window. Chrome used to show the viewport dimensions at the top right of the window, when you resize the viewport by dragging the central divider.

How do you use chrome with developer tools?

I use Chrome with developer tools docked to the right hand side of the window. Chrome used to show the viewport dimensions at the top right of the window, when you resize the viewport by dragging the central divider. I've always found it useful for testing responsive sites and media queries.

What is Chrome DevTools and how does it work?

Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser.

How to use Chrome DevTools to inspect DOM elements?

There are many ways to open Chrome DevTools, because different users want fast access to different parts of the DevTools UI. When you want to inspect a DOM node's styles or attributes, right-click the element and select Inspect. Figure 1. The Inspect option Or press Command + Option + C (Mac) or Control + Shift + C (Windows, Linux, ChromeOS).


2 Answers

FYI those dimension numbers are document.documentElement.clientWidth and document.documentElement.clientHeight.

Robert is correct. Make sure the zoom ratio is 100% to get the correct dimensions.

like image 88
Neo Avatar answered Sep 20 '22 16:09

Neo


That's including the vertical scroll bar's width. Try removing the scroll bar and then check. It will match exactly.

like image 23
Nagaraj . Avatar answered Sep 20 '22 16:09

Nagaraj .