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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:52:16+00:00 2026-06-12T14:52:16+00:00

I have multiple @media queries all working fine but as soon as i put

  • 0

I have multiple @media queries all working fine but as soon as i put in a higher max screen-width than 1024px the rules for the higher width gets applied to everything.

    @media screen and (max-width: 1400px)
    {
        #wrap {
        width: 72%;
        }
    } 
@media screen and (max-width: 1024px) 
{
    #slider h2 {
    width: 100%;
    }
    #slider img {
    margin: 60px 0.83333333333333% 0 2.08333333333333%;
    }
    .recent {
    width: 45.82%;
    margin: 10px 2.08333333333334% 0 1.875%;
    }
}

as you can see 1024px (and also the 800px max-width query) do not change the #wrap width and work fine. As soon as i add the 1400px max-width query it changes them to 72% for ALL sizes and does the same for any element – for instance if i set #slider img to have a margin of 40px it will show at ALL sizes even though it is only in the max-width of 1400px.

Am i missing something really obvious? Been trying to work this out for the past 2 days!
Thanks, John

  • 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-12T14:52:17+00:00Added an answer on June 12, 2026 at 2:52 pm

    I’m not sure I entirely follow, but your @media rules suggest this is the behaviour you want. If the screen is 1400px and lower the width of #wrap will be 72%, this includes all other sizes mentioned in other media queries.

    If you wanted it to only apply between 1024px and 1400px you need to change it to…

    @media screen and (max-width: 1400px) and (min-width: 1024px)
    {
        #wrap {
        width: 72%;
        }
    } 
    

    EDIT You also have to remember that ordering matters in CSS…

    @media screen and (max-width: 1400px)
    {
        #wrap {
        width: 72%;
        }
    }
    @media screen and (max-width: 1024px)
    {
        #wrap {
        width: 100%;
        }
    }
    

    For screens above 1024px the width of #wrap will be 72% as they will only match the first media query. If the screen is below 1024px the width of #wrap will be 100%, although it will be matched by both media queries. The CSS that will be rendered for a screen under 1024px will look like…

    #wrap {
    width: 72%;
    }
    #wrap {
    width: 100%;
    }
    

    Rules defined later in the stylesheet overrides earlier rules http://www.w3.org/TR/CSS21/cascade.html#cascading-order 6.4.1 point 4. Therefore, if you swapped the order of the rules.

    @media screen and (max-width: 1024px)
    {
        #wrap {
        width: 100%;
        }
    }
    @media screen and (max-width: 1400px)
    {
        #wrap {
        width: 72%;
        }
    }
    

    The width of #wrap will be 72% for ALL screen sizes up to 1400px because a screen under 1024px will see both rules as if they were…

    #wrap {
    width: 100%;
    }
    #wrap {
    width: 72%;
    }
    

    A screen over 1024px will see…

    #wrap {
    width: 72%;
    }
    

    Both have the same result.

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

Sidebar

Related Questions

How do I define multiple media queries in one file? I have this .styl-file:
I have multiple domains on my server. I want to redirect all of them
I have backups of files archived in optical media (CDs and DVDs). These all
I have successfully installed mercurial on media temple grid server. But I can not
I have a media application (written in Delphi 2010 but I am not sure
I am creating an application that will have multiple images on the screen, these
Im mobile optimising my site with media queries. Is it safe to use multiple
This question is NOT about what CSS Media Queries are, but more on what
I have multiple ajax requests with javascript code as response, and I need to
I have multiple projects which are to be hosted together in a Tomcat container,

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.