User Agents

Web browsers and everyday web tech, explained

Test Gallery Browser Size: How It Works

· 5 min read · Browsers

In this article
  1. What "Browser Size" Actually Means
  2. How Test Galleries Use Browser Size
  3. How to Check Your Browser Size
  4. Common Problems with Browser Size and Galleries
  5. How to Choose the Right Browser Size for Testing
  6. Browser Size vs. Image File Size
  7. Frequently Asked Questions

The browser size of a test gallery is the viewport width and height (in pixels) that the gallery uses to decide how many thumbnails to show per row and how large each image appears. In short, it is the CSS pixel dimensions of the browser window, not the screen resolution, and it directly controls responsive breakpoints in the gallery's layout.

What "Browser Size" Actually Means

When someone asks about a test gallery's browser size, they are usually referring to the viewport—the visible area of the browser window, excluding toolbars, scrollbars, and the browser chrome. This is measured in CSS pixels, which are not the same as physical device pixels. For example, a phone with a 1080px wide screen might report a viewport of 360px because of its device pixel ratio (DPR) of 3. The gallery sees the CSS width, not the raw hardware resolution.

The key distinction: screen resolution is the physical pixel count of your monitor, while browser size is the viewport CSS size. A 1920×1080 monitor with a maximized browser might have a viewport of about 1920×937 because the browser's tab bar, address bar, and bookmarks bar take up vertical space. If you zoom in or out, the CSS pixel size changes even though the screen resolution stays the same.

How Test Galleries Use Browser Size

Test galleries (often used by photographers, web designers, or stock photo sites to demo a layout) use JavaScript or CSS media queries to read the viewport width and adjust the grid. The most common approach is to set a min-width or max-width breakpoint. For instance:

  • Viewport width ≥ 1200px: 5 columns of thumbnails
  • Viewport width 768–1199px: 3 columns
  • Viewport width 480–767px: 2 columns
  • Viewport width < 480px: 1 column

These breakpoints are defined in CSS with @media rules. The gallery reads the viewport width via window.innerWidth (JavaScript) or the CSS vw unit. Some galleries also account for the height—for example, a lightbox might show a larger image if the viewport height is tall enough, but most grid layouts only care about width.

How to Check Your Browser Size

If you want to know the exact browser size a test gallery is seeing, you have a few simple methods:

  1. Open the browser's developer tools (F12 or right-click → Inspect). In the top-left of the DevTools, click the device toggle icon (a small rectangle with a phone or tablet). This shows a viewport size indicator at the top, e.g., “Responsive 375×667”.
  2. Use a JavaScript snippet in the console: type window.innerWidth and window.innerHeight to get the CSS viewport size in pixels.
  3. Visit a dedicated “what’s my browser size” website—these sites display your current viewport dimensions live.

Note that the viewport size changes if you resize the browser window, open the developer tools docked to the side, or zoom the page (Ctrl/Cmd + and Ctrl/Cmd −). Zooming changes the CSS pixel size because the browser adjusts the number of CSS pixels that fit in the physical screen.

Common Problems with Browser Size and Galleries

One frequent issue is that a gallery looks great on a desktop but breaks on a tablet or phone. This usually happens because the gallery’s breakpoints are not set correctly, or because the images have fixed pixel widths instead of flexible ones. Another problem is the scrollbar: on Windows, a vertical scrollbar takes up about 15–17px of width, so the viewport is narrower than the full screen width. On macOS, scrollbars overlay and don’t take up space, which can cause a gallery to show an extra column on a Mac compared to a Windows PC at the same screen resolution.

Another misconception is that browser size equals device size. A phone in landscape mode has a wider viewport than in portrait, but the physical device is the same. Test galleries that don’t handle orientation changes may show a broken layout when the user rotates their phone.

How to Choose the Right Browser Size for Testing

When testing a gallery, you should check the most common viewport sizes your audience uses. As of 2024, common breakpoints are:

  • 320px (small phones)
  • 375px (iPhone SE/older iPhones)
  • 768px (tablets portrait)
  • 1024px (tablets landscape, small laptops)
  • 1440px (standard desktop)
  • 1920px (full HD desktop)

For a test gallery, you don’t need to test every possible size—just the extremes and a few midpoints. Use the browser’s responsive mode to drag the viewport width and watch how the gallery reflows. Also test with zoom levels at 75%, 100%, and 125% because many users zoom in and out.

Browser Size vs. Image File Size

A common confusion is mixing up browser size (viewport) with the actual image dimensions in pixels. A gallery might display a thumbnail at 300×200px, but the original image file might be 4000×3000px. The browser size only determines how many thumbnails fit on screen, not the resolution of the images themselves. However, the gallery should serve appropriately sized images—if the viewport is 375px wide, sending a 4000px-wide image wastes bandwidth and slows loading. Responsive galleries use srcset to serve smaller images on smaller viewports.

Frequently Asked Questions

Does browser size include the browser toolbar?

No. The browser size (viewport) is the area where the webpage renders, excluding the tab bar, address bar, bookmarks bar, and status bar. The viewport height is typically shorter than the screen height because of these elements.

Why does my gallery show 5 columns on my friend's computer but 4 on mine?

The most likely reason is a different viewport width due to screen resolution, window size, or zoom level. If your friend has a wider monitor or a maximized window, they get more columns. Also, if you have the browser zoomed in (e.g., 110%), your viewport width in CSS pixels is smaller, so fewer columns fit.

How do I make a test gallery ignore browser size?

You can force a fixed number of columns by setting a fixed width on the gallery container and disabling responsive breakpoints. For example, set the gallery to width: 1200px and overflow-x: auto so it scrolls horizontally on smaller viewports. However, this is generally bad UX on mobile and should only be used for testing.

What is the difference between viewport and device width?

Viewport is the CSS pixel size of the browser window. Device width is the physical pixel width of the screen. On a phone with a 750px physical width and a DPR of 2, the viewport is 375px. In the <meta name="viewport"> tag, width=device-width sets the viewport width to the device's CSS width, which is the correct way to make responsive galleries work on mobile.

Can browser size affect image loading speed?

Indirectly, yes. If the gallery uses responsive images, a smaller viewport will load smaller image files, which are faster. But the browser size itself does not change network speed; it just influences which image source the browser picks. A larger viewport loads larger images, which can slow down the page on a slow connection.