Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Chrome DevTools Responsive viewport think it's 980px wide?

I've used Chrome DevTools to resize the viewport to 480px wide, as shown below.

I'm using bootstrap's grid layout, so I have a div.container that I'm using, as shown in the bottom left. When I hover over it, I see chrome has that particular div marked as width 750px (and the whole body is 980px), even though I clearly have the screen set at a smaller resolution. Even the ruler at the top shows it is 480px wide.

For further confirmation, you can see the media query that says the width of 750px should only be set at higher resolutions (min 768px), so the viewport is assuming it's a higher width than it is.

Am I mis-understanding how the responsive feature is used?

Thanks!

enter image description here

like image 708
user2490003 Avatar asked Apr 13 '16 05:04

user2490003


People also ask

How do I change DevTools position in Chrome?

Change where DevTools is docked by using the Command Menu Or, press Shift + Ctrl + P on Windows/Linux or Command + Shift + P on macOS. Type dock, and then select a dock command: Dock to bottom.

How do I change DevTools layout?

In the developer tools, klick the cogwheel icon (or press F1 when focusing the dev tools) to open the settings overlay. Under "Preferences", in the "Appearance" section, find the "Panel layout" option. Set it to your liking.


2 Answers

For accepting answer

As stated in comments: you are missing meta tag with viewport that is required for media-queries to take effect.

like image 130
Justinas Avatar answered Oct 02 '22 07:10

Justinas


As answered above, adding a metatag in html header will resolve the issue. Below is the viewport element, which should be included in all your web pages

<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
like image 27
Siva Avatar answered Oct 02 '22 07:10

Siva