Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:40:31+00:00 2026-06-07T10:40:31+00:00

I’ve been asked to retrofit an existing website with a mobile layout. The website

  • 0

I’ve been asked to retrofit an existing website with a mobile layout. The website was built on a WordPress Twenty11 framework, so I decided to build the mobile layout using the existing media queries in that framework.

Now, my mobile layout looks great on any desktop browser dragged down to be less than 420px wide, but on iPhone & Android mobile browsers it just loads the full-width webpage anyhow. Full web experience, woot!

Client unhappy. Wants mobile design to show up on all iPhone browsers. So now I need to work out why the mobile browsers insist on showing the page at the full desktop width, ignoring the mobile CSS entirely.

Here’s my media queries, down the bottom of the main style.css document:

@media (max-width: 800px) {
/* Design starts to get a little more fluid */
}

@media (max-width: 650px) {
/* Design gets quite a lot more fluid, and columns start dropping off the edge to below     main content */
}

@media (max-width: 450px) {
/* Totally changed navigation for small viewports, main content takes up whole viewport */
}

All of these do what I want when I manually resize a browser window on a desktop machine. They also do what I want when I test them in next-to-useless iFrame-based “iPhone emulators”. But all mobile devices so far tested stubbornly show the full-width layout, zoomed really far out and unreadable.

Is there something I should be adding to those media queries to MAKE the mobile browsers display the mobile CSS? Or should I be going with a different strategy altogether, such as user-agent detection or similar?

EDITED TO ADD:
Something like this line in header.php, I am guessing:

<meta name="viewport" content="width=960,
                           maximum-scale=1.0">

should in fact be

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

right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:40:33+00:00Added an answer on June 7, 2026 at 10:40 am

    You should add min-width parameters to your media queries because at the moment someone with a small screen will be getting rules from all three of your media queries since it’s max width will be less than 800px.

    @media (min-width: 651px AND max-width: 800px) {
        ...
    }
    
    @media (min-width: 451px AND max-width: 650px) {
        ...
    }
    
    @media (max-width: 450px) {
        ...
    }
    

    If you attempt to get too complex with media queries you’ll run into tons of problems. Different browsers handle them differently making them less than ideal for a production environment.

    A method that I like to use is to create a simple JS event handler for the window.resize event that only adds a class to the <html> element to specify what screen-break-point the user is at. Then in your CSS you just prefix rules with the breakpoint-classes:

    $(window).on('resize', function () {
        var w = $(this).width();
        if (w > 1400) {
            $('html').addClass('widescreen-viewport');
        } else if (w > 1024) {
            $('html').addClass('desktop-viewport');
        } else if (w > 767) {
            $('html').addClass('tablet-viewport');
        } else {
            $('html').addClass('mobile-viewport');
        }
    });
    

    Sorry for the jQuery but this is a way I know works for sure.

    Then your CSS would be something like:

    #some-element {
        /*default styles*/
    }
    .widescreen-viewport #some-element {
        /*widescreen styles*/
    }
    .desktop-viewport #some-element {
        /*desktop styles*/
    }
    .tablet-viewport #some-element {
        /*tablet styles*/
    }
    .mobile-viewport #some-element {
        /*mobile styles*/
    }
    

    This method will receive better browser support as it requires JS to be enabled but other than that, it’ll work back to IE6/5.5 and other browsers from that time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.