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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:10:42+00:00 2026-06-13T15:10:42+00:00

Currently using SASS on a website build. It is my first project using it,

  • 0

Currently using SASS on a website build. It is my first project using it, tried a little LESS before and liked it. I made a few basic mixins and variables with LESS, super useful stuff!

I am trying to get my head around SASS mixins, and syntax, specifically for swapping images when the page changes to a different language, be that with body ID changing or <html lang="en">. And, swapping floats around if, for example, a website changed to Chinese. So a mixin where float left is float left unless language is AR and then it becomes float right.

With LESS I think it would be something like:

.headerBg() when (@lang = en)  {background-image:url(../img/hello.png);}
.headerBg() when (@lang = it)  {background-image:url(../img/ciao.png);}

.header {.headerBg(); width: 200px; height:100px}

.floatleft() when (@lang = en) { float: left;}
.floatleft() when (@lang = ar) { float: right;}

.logo {.floatleft();}

It’s the syntax I am having problems with.

  • 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-13T15:10:44+00:00Added an answer on June 13, 2026 at 3:10 pm

    I’d probably use the @content feature and do something like this:

    @mixin headerBg {
        .header {
            @content
        }
    }
    
    @mixin floatDir {
        .logo {
            @content
        }
    }
    
    :lang(en) {
        @include headerBg {
            background-image:url(../img/hello.png);
        }
        @include floatDir {
            float: left;
        }
    }
    
    :lang(ar) {
        @include headerBg {
            background-image:url(../img/ciao.png);
        }
        @include floatDir {
            float: right;
        }
    }
    

    Which compiles to:

    :lang(en) .header {
      background-image: url(../img/hello.png); }
    :lang(en) .logo {
      float: left; }
    
    :lang(ar) .header {
      background-image: url(../img/ciao.png); }
    :lang(ar) .logo {
      float: right; }
    

    If the background image names where based on the language, then it might make sense to use @each and do something like this:

    @each $lang in en, ar {
        :lang(#{$lang}) {
            @if $lang == en {
                .logo {
                    float: left;
                }
            } @else if $lang == ar {
                .logo {
                    float: right;
                }   
            }
            .header {
                background-image:url(../img/#{$lang}.png);
            }
        }
    }
    

    Which compiles to:

    :lang(en) .logo {
      float: left; }
    :lang(en) .header {
      background-image: url(../img/en.png); }
    
    :lang(ar) .logo {
      float: right; }
    :lang(ar) .header {
      background-image: url(../img/ar.png); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using MySQL version 5.1.6 This is my first real world build and so
I'm using Sass (.scss) for my current project. Following example: HTML <div class=container desc>
I'm currently using the NEST ElasticSearch C# Library for interacting with ElasticSearch. My project
I am using jruby-1.6.6 with rails 3.2 currently. And I am using gem 'bootstrap-sass',
Currently using Chrome v19.0.1084.46 (Official Build 135956) beta-m jqGrid 4.3.2 (latest release) The problem
I am currently using the community edition of jasperReports Server 4.1.0 build 20110626_0015. basically,
I'm currently using Mindscape Web Workbench to create css from sass. I'm using an
I'm using Sass 3.1.10 with Compass 0.11.5. I need to compile my compass project
Currently using Gettext on a project and the .po files are nicely kept under
I currently using my own membership implementation on a ASP.MVC project. I've got an

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.