← all guides

How to Test Responsive HTML Designs

More than half of all web traffic comes from mobile devices. If your HTML doesn't adapt to different screen sizes, you're losing visitors. Responsive design means your layout adjusts to fit phones, tablets, and desktops — and testing it is easier than you might think.

What is responsive design?

Responsive design is an approach where your HTML and CSS adapt to the screen size of the device viewing it. Instead of building separate pages for mobile and desktop, you write one set of markup that rearranges itself using CSS media queries, flexible widths, and relative units.

Testing with HTML Viewer Cat

HTML Viewer Cat includes built-in responsive preview. Here is how to use it:

  1. Paste your HTML into the editor
  2. Click the phone icon to preview at 375px (typical phone width)
  3. Click the tablet icon for 768px (iPad-width preview)
  4. Click the desktop icon for full width
  5. Use fullscreen mode for an unobstructed view of your layout

The viewport meta tag

For responsive HTML to work, you need the viewport meta tag in your <head>:

<meta name="viewport"
  content="width=device-width, initial-scale=1.0">

Without this, mobile browsers will render your page at a desktop width and zoom out, making everything tiny and unreadable.

CSS media queries

Media queries let you apply different styles at different screen widths:

<style>
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
  }
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  @media (max-width: 768px) {
    .grid {
      grid-template-columns: 1fr;
    }
  }
</style>

Common responsive design mistakes