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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:43:05+00:00 2026-06-18T10:43:05+00:00

Got a Sass issue which is driving me insane. Basically I have the following

  • 0

Got a Sass issue which is driving me insane. Basically I have the following Sass code:

$breakpoints: mobile 320px, tablet 760px, desktop 960px;

@mixin setbreakpoint($point) {
    @each $breakpoint in $breakpoints {
      @if $point == #{nth($breakpoint, 1)} {
        @media (min-width: #{nth($breakpoint, 2)}) { @content; }
      }
    }
}

.page-wrap {
  width: 75%;
  @include setbreakpoint(mobile) { content:"mobile"; }
  @include setbreakpoint(tablet) { content:"tablet"; }
  @include setbreakpoint(desktop) { content:"desktop"; }
}

@each $breakpoint in $breakpoints {
    .page-wrap-#{nth($breakpoint, 1)} { content:#{nth($breakpoint, 2)}; }
}

Which outputs the following css:

.page-wrap {
  width: 75%; }
  @media (max-width: 320px) {
    .page-wrap { content: "mobile"; } }
  @media (max-width: 760px) {
    .page-wrap { content: "mobile"; } }
  @media (max-width: 960px) {
    .page-wrap { content: "mobile"; } }
  @media (max-width: 320px) {
    .page-wrap { content: "tablet"; } }
  @media (max-width: 760px) {
    .page-wrap { content: "tablet"; } }
  @media (max-width: 960px) {
    .page-wrap { content: "tablet"; } }
  @media (max-width: 320px) {
    .page-wrap { content: "desktop"; } }
  @media (max-width: 760px) {
    .page-wrap { content: "desktop"; } }
  @media (max-width: 960px) {
    .page-wrap { content: "desktop"; } }

.page-wrap-mobile {
  content: 320px; }

.page-wrap-tablet {
  content: 760px; }

.page-wrap-desktop {
  content: 960px; }

Question is:
Why does the mixin each loop produce 9 results where the basic class each loop produces 3?

  • 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-18T10:43:06+00:00Added an answer on June 18, 2026 at 10:43 am

    It’s because of this if statement right here:

    @if $point == #{nth($breakpoint, 1)} {
        @media (min-width: #{nth($breakpoint, 2)}) { @content; }
    }
    

    You’re comparing variables with different types. For whatever reason, the compiler always thinks they’re equal. All you have to do is remove the string interpolation and it works as you expect:

    @if $point == nth($breakpoint, 1) {
        // You don't need when displaying the value either...
        @media (min-width: nth($breakpoint, 2)) { @content; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Got a bug in some legacy code which communicates with a payment terminal. Just
So we've got a standard Compass CSS project, with the sass and css directories.
I've got some experience using haml (+sass) on rails projects. I recently started using
I've got a bunch of 'bootstrap' sass files I'd like to stick in my
Got a complex SELECT query, from which I would like to insert all rows
got a strange issue for you. I created a control that inserts a record
I got my workplace to agree to using SASS/Compass and we work in ASP.NET
I have tried this $ sudo gem install sass and it gives me an
Got code like: <?php require_once(../classes/pdo.class.php); $db = new mysql(); $db->connect(); class votingpanel{ public function
I've got an existing project that uses vanilla SASS , and I'd like to

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.