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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:41:19+00:00 2026-06-04T21:41:19+00:00

I am working on a sass stylesheet in which I wish to use the

  • 0

I am working on a sass stylesheet in which I wish to use the calc element to dynamically size some content. As the calc element has not been standardized, I need to target calc(), -moz-calc(), and -webkit-calc().

Is there a way for me to create a mixin or function that I can pass an expression to so that it will generate the required tags that can then be set as a width or height?

  • 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-04T21:41:21+00:00Added an answer on June 4, 2026 at 9:41 pm

    It would be a basic mixin with an argument, thankfully the expressions are not browser-specific within the supported scope:

    @mixin calc($property, $expression) {
      #{$property}: -webkit-calc(#{$expression});
      #{$property}: calc(#{$expression});
    }
    
    .test {
      @include calc(width, "25% - 1em");
    }
    

    Will render as

    .test {
      width: -webkit-calc(25% - 1em);
      width: calc(25% - 1em);
    }
    

    You may want to include a “default” value for when calc is not supported.

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

Sidebar

Related Questions

I am using SASS and it has been working, but now I get this...
I recently started using Compass/Sass for my CSS coding and it has been working
SASS is not creating the CSS files, but HAML is working just fine. I
Working in Drupal today and simple cell spacing has been anything but simple for
I am trying to get compass/sass/haml working using blueprint but not having any luck
So I'm working on some HTML5 code using HAML and SASS. I currently have
I'm currently working on a team that uses SASS. I see that we are
Working on game where plates will be falling from top to bottom. Some plates
I need to change all the CSS into SASS... and find that margin:10px working
I am relatively new to rails and have been working my way through the

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.