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

  • Home
  • SEARCH
  • 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 8976613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:11:17+00:00 2026-06-15T19:11:17+00:00

I have .cssClass containing: // fallback without calc width: 60%; @media (max-width: 500px) {

  • 0

I have .cssClass containing:

// fallback without calc
width: 60%; 
@media (max-width: 500px) { width: 58%; }
@media (max-width: 460px) { width: 55%; }
@media (max-width: 420px) { width: 50%; }
@media (max-width: 380px) { width: 45%; }
@media (max-width: 340px) { width: 40%; }
// using calc
width: -webkit-calc(70% - (34px + 1.12em));
width: -moz-calc(70% - (34px + 1.12em));
width: -ms-calc(70% - (34px + 1.12em));
width: -o-calc(70% - (34px + 1.12em));
width: calc(70% - (34px + 1.12em));

So if the browser supports calc, It will replace the previously defined width (60%) and It will use the calc approach.

However It’s still using the media-queries when resizing, replacing the calc value with the queries values.

I’m getting a good result in browsers that don’t support calc, because it’s just ommiting all that stuff, but browsers that do support calc, obtain the calc result mixed with the fallback queries.

What should I do? I only want the media-queries to run if there’s no calc support.

I’m looking for a solution or another approach without involving JavaScript.

  • 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-15T19:11:18+00:00Added an answer on June 15, 2026 at 7:11 pm

    SASS will sort nested properties to have media queries last.

    Here are some examples of what happens:

    SCSS

    body {
        background: #000000; //black
    
        @media (max-width: 500px) { 
            background: #990000; //red
        }
    
        background: #000099; //blue
    
        @media (max-width: 300px) { 
            background: #009900; //green
        }
    }
    

    Output CSS

    body {
        background:#000;
        background:#009
    }
    @media (max-width: 500px) {
        body {
            background:#900
        }
    }
    @media (max-width: 300px) {
        body {
            background:#090
        }
    }
    

    Demo

    What you can do is put in a second nest to manipulate the sort order:

    SCSS

    body {
        background: #000000; //black
    
        @media (max-width: 500px) { 
            background: #990000; //red
        }
    
    
    }
    body {
        background: #000099; //blue
    
        @media (max-width: 300px) { 
            background: #009900; //green
        }
    }
    

    Output CSS

    body {
        background:#000
    }
    @media (max-width: 500px) {
        body {
            background:#900
        }
    }
    body {
        background:#009
    }
    @media (max-width: 300px) {
        body {
            background:#090
        }
    }
    

    Demo

    So you can do this with your code and it should sort in the correct order:

    SCSS

    .cssClass {
        // fallback without calc
        width: 60%; 
        @media (max-width: 500px) { width: 58%; }
        @media (max-width: 460px) { width: 55%; }
        @media (max-width: 420px) { width: 50%; }
        @media (max-width: 380px) { width: 45%; }
        @media (max-width: 340px) { width: 40%; }
    }
    .cssClass {
        // using calc
        width: -webkit-calc(70% - (34px + 1.12em));
        width: -moz-calc(70% - (34px + 1.12em));
        width: -ms-calc(70% - (34px + 1.12em));
        width: -o-calc(70% - (34px + 1.12em));
        width: calc(70% - (34px + 1.12em));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an aspx page with a Masterpage containing a panel with a CssClass
I have this following code, here CssClass is of the String type. <asp:Panel ID=Panel1
I have a css class where the LEFT needs the be the WIDTH of
I'm using literal to implement css, so as to have the css class vary
I have a problem with a master page containing a asp:textbox that I'm trying
I am using ExtJS to build a window containing several panels as items. One
I have a JQuery Dialog, with a control inside containing textboxes, I also have
I have a list box in my aspx page: <asp:ListBox ID=lstTreatmentProvider runat=server SelectionMode=Multiple Width=175px
I'm working with WebForms. HtmlTableCell does not have a CssClass property. I can do
I have 4 li's under ul. I made two of them hidden using visisblity

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.