Where to find the viewport meta tag on Magento?

Where to find the viewport meta tag on Magento?

August 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Where to find the viewport meta tag on Magento?

Responsive Design and Magento: Locating the Viewport Meta Tag

As a senior developer working extensively with e-commerce platforms like Magento, I often receive queries about how to modify responsive design elements in existing sites. One of the most common concerns is finding the viewport meta tag to disable responsive behavior.

The viewport meta tag defines the dimensions and scaling of the page on different devices. By default, Magento uses this tag to enable a responsive layout across various screen sizes. However, if you need to make your site non-responsive for any reason, you’ll first have to locate this meta tag.

Where Is the Viewport Meta Tag Located in Magento?

In Magento 2, the viewport meta tag is typically found within the head section of your theme’s default layout files or XML layouts. Here are two common places where you might find it:

  1. Default Layout XML Files: Magento uses a modular file structure for its themes and layouts. Check if your active theme has a default.xml file located in the following path:

    app/design/frontend/{YourThemeVendor}/{YourThemeName}/Magento_Theme/layout/default.xml
    
  2. Default Head Block: Even when not explicitly defined, Magento adds some default meta tags including viewport to the <head> block of your pages. To verify this, you can check any page layout XML file under app/design/frontend/{YourThemeVendor}/{YourThemeName}/Magento_Theme/layout. Look for a <head> block containing something like this:

    <referenceContainer name="head">
        <block class="Magento\Theme\Block\Html\Head" name="head.components"/>
    </referenceContainer>
    

Removing or Modifying the Viewport Meta Tag

If you do find the viewport meta tag in your XML layout files, you can remove or modify it to disable responsive design.

To remove the responsive meta tag entirely:

  • Open the default.xml file mentioned earlier.
  • Find and delete any line containing <meta name="viewport" content="width=device-width, initial-scale=1">.
  • Save the changes and clear your cache if necessary.

Alternatively, if you want to keep some aspects of responsiveness but modify others, you can change the meta tag attributes. For example, setting a fixed width for all devices:

<meta name="viewport" content="width=900">

Why You Should Think Twice Before Removing Responsive Design

Before rushing to remove responsive design features from your Magento site, consider the implications:

  1. User Experience: Most users expect modern websites to adapt to their device’s screen size for optimal viewing.
  2. SEO Performance: Google and other search engines favor mobile-friendly sites when ranking results for mobile searches.
  3. Future-Proofing: Removing responsive design may limit your site’s ability to adapt to new devices or screen sizes released in the future.

In most cases, it’s better to optimize your existing responsive theme rather than trying to make a Magento site non-responsive entirely. If you need help with responsive design optimization or any other Magento development needs, feel free to reach out to our team at Laravel Company. We’re always ready to provide expert guidance and solutions tailored to your specific requirements.

Happy coding!

Magento 2 Themes SEO

Our network