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 9084985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:08:08+00:00 2026-06-16T21:08:08+00:00

I have built a responsive website with media queries to target different mobile devices

  • 0

I have built a responsive website with media queries to target different mobile devices but would like to have an “override all” link available on smaller devices. When clicked, the link would remove all media query styles and reset the page to default styles, exposing the site as it would at 1024px wide. Is there a way to achieve this?

  • 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-16T21:08:10+00:00Added an answer on June 16, 2026 at 9:08 pm

    The only way you can do this is with Javascript. I came up with two solutions:

    id/class on <html> element:
    Apply an id or class to the html element: <html class="media-queries">.
    In your media-queries, every selector will start with .media-queries:
    CSS

    @media (max-width: 300px) {
        .media-queries #nav li {
            display: block;
        }
        .media-queries #main, .media-queries #aside {
            float: none;
        }
    }
    

    Then, you get JS to remove class="media-queries".
    HTML

    <a id="del-mq" href="#">Default style</a>
    

    JavaScript

    var delMQ = document.getElementById('del-mq');
    delMQ.onclick = function() {
        document.getElementsByTagName('html')[0].removeAttribute('class');
    }
    

    jQuery

    $('#del-mq').click(function() {
        $('.media-queries').removeClass();
    });
    

    Pros: no extra http requests.
    Cons: lots of css selectors(.media-queries), which shouldn’t be a problem if using Sass:

    @media (max-width: 300px) {
        .media-queries {
            #nav...
            #main...
        }
    }
    

    External media-queries.css
    All the media queries go in a separate css file. Include it with <link rel="stylesheet" href="media-queries.css">.
    Then you get an ID for the <link> and remove the element.
    HTML

    <head>
        <link rel="stylesheet" href="default.css">
        <link id="media-queries" rel="stylesheet" href="media-queries.css">
    </head>
    <body>
        ...
        <a id="del-mq" href="#">Default style</a>
        ...
    </body>
    

    Javascript

    var delMQ = document.getElementById('del-mq');
    delMQ.onclick = function() {
        document.getElementsByTagName('head')[0].removeChild(document.getElementById('media-queries'));
    }
    

    jQuery

    $('#del-mq').click(function() {
        $('#media-queries').remove();
    });
    

    Pros: no need for lots of css selectors.
    Cons: extra http request.

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

Sidebar

Related Questions

I have a responsive website built on top of Bootstrap. However, I only want
I am trying to build a responsive email template but have run into some
I have built the UI for my Google Chrome Extension, but I am trying
I'm adding responsive styles for our website built in Plone 4 CMS and testing
I have a website that is built in ASP.NET 3.5 & SQL Server 2005,
Right now I have build a small framework, and I would like to host
I have followed all the directions from the Facebook Developer website about integrating Facebook
I have an application built that works like a form, it takes four fields
I have a plugin.js that combine all my plugins for my responsive build. This
I have built a website based on Google App Engine. It includes ten models,

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.