CSS responsive styles function during browser window resizing but fail on actual mobile phones in WordPress

I’m working on a custom WordPress theme and having trouble with responsive CSS. My media queries work when I test by resizing the browser window on my computer, but they don’t work when I actually view the site on a mobile device.

Here’s the CSS I’m using:

@media (max-width: 768px) {
    .main-content {
        font-size: 14px;
        padding: 10px;
    }
}

The strange thing is that desktop browser testing shows the styles applying correctly when the window gets smaller. However, when I check the same page on my phone, the mobile styles never kick in.

I’m not using any special plugins, just regular CSS in my theme files. The stylesheet loads fine since other styles work normally.

Could there be something in WordPress configuration that blocks media queries on mobile? Maybe I need to include some special HTML tags in the header section?

Has anyone else run into this issue before?

Classic mobile viewport issue - trips up tons of developers. Your phone’s browser thinks it’s loading a desktop site, so it uses a super wide virtual viewport and scales everything down to fit. Since the browser believes it has all that width, your max-width media queries never kick in. Hit this exact problem on a WordPress project last year. Fix is simple: add the viewport meta tag to your theme’s header.php. Without it, mobile devices keep showing the desktop layout no matter what breakpoints you set. Add that viewport tag and mobile browsers will actually use the real screen size, making your responsive CSS work properly.

Had this exact problem last year building a client site. You’re missing the viewport meta tag in your header.php - that’s almost definitely what’s causing this. Without it, mobile browsers think your site is desktop-sized and zoom out to fit everything on screen. Your media queries never fire because the browser thinks it’s got way more screen width than it actually does. Look for this line in your theme’s header.php between the head tags: . If it’s not there, add it and your media queries should work fine on mobile. This tag just tells the browser to use the device’s real width instead of pretending it’s desktop.

same thing happened 2 me. check if u’ve got the viewport meta tag in your header - that’s prbably what’s missing. without it, mobile browsers think they’re desktop-sized, so your css thinks it’s dealin with a huge screen. super annoying but easy to fix.