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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:52:52+00:00 2026-06-05T17:52:52+00:00

Can someone please explain to me how this responsive approach works? This was done

  • 0

Can someone please explain to me how this responsive approach works? This was done using the LESS framework. How is the author achieving the desired device specific behavior?

.responsive (@scale: 1) {

/*Responsive code goes here for example*/
.logo {
        padding: 44px * @scale 0 33px * @scale;

        img {
            width: 580px * @scale;
            height: 90px * @scale;
        }
    }
}

.responsive;

@media screen and (min-width: 480px) and (max-width: 639px) {
    .responsive(0.75);
}

@media screen and (min-width: 320px) and (max-width: 479px) {
    .responsive(0.5);
}

@media screen and (max-width: 319px) {
    .responsive(0.25);
}
  • 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-05T17:52:54+00:00Added an answer on June 5, 2026 at 5:52 pm

    A quick lesson on the LESS framework first. It’s basically a preprocessor of CSS that uses coding concepts to make CSS much more easy and readable to write.

    The Less stylesheet translates to CSS as follows:

    .logo {
      padding: 44px 0 33px;
    }
    .logo img {
      width: 580px;
      height: 90px;
    }
    @media screen and (min-width: 480px) and (max-width: 639px) {
      /*Responsive code goes here for example*/
      .logo {
        padding: 33px 0 24.75px;
      }
      .logo img {
        width: 435px;
        height: 67.5px;
      }
    }
    @media screen and (min-width: 320px) and (max-width: 479px) {
      /*Responsive code goes here for example*/
      .logo {
        padding: 22px 0 16.5px;
      }
      .logo img {
        width: 290px;
        height: 45px;
      }
    }
    @media screen and (max-width: 319px) {
      /*Responsive code goes here for example*/
      .logo {
        padding: 11px 0 8.25px;
      }
      .logo img {
        width: 145px;
        height: 22.5px;
      }
    }
    

    As you can see, there is a lot of repetition in the CSS and it is not very readable (not to speak of how much work it would be to change the aspect ratio of the logo image).

    At the top of the Less code, you see this:

    .responsive (@scale: 1) {
    
        /*Responsive code goes here for example*/
        .logo {
            padding: 44px * @scale 0 33px * @scale;
            img {
                width: 580px * @scale;
                height: 90px * @scale;
            }
        }
    }
    

    The above code is referred to as a “parametric mixin”, think of these as classes in object oriented languages. You can pass in variables, set variables and rules in these “mixins”. In this case, @scale is the parameter and a default value of 1 is passed in. You pretty much set rules inside the mixins, except one cool thing you can do with LESS is declare “nested” rules (which is what you see with the img selector inside the .logo selector. This is essentially the same as .logo img{/*rules*/} – which is what the resulting CSS would have. Refer to this site for a complete document on LESS: http://lesscss.org/

    Now the media query aspect of it. As you can see, .responsive mixin is declared first – so think of this ruleset as the “default” viewport rules.

    The first media query @media screen and (min-width: 480px) and (max-width: 639px) states that for ALL viewports that have a browser width more than 480px and less than 639px, apply whatever rules specified – in this case .responsive(0.75); (so rescaling dimensions in the mixin with 0.75 as the parameter). Therefore, when this argument is met, the cascading aspect of CSS will override the default rules set out beforehand with the rules inside the media query.

    The same concept would apply for the other media queries. Just think of min-width and max-width as breakpoint setters. Wherever you see a min-width defined, the rules will be applied for all viewports that are larger than or at least that defined breakpoint. Likewise, for max-width rules are applied for all viewports that are less than the specified breakpoint. And you can combine both min-width and max-width in a media query to obtain a range of viewports to apply rules to.

    For more information I suggest looking at this article http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/

    It’s got an excellent explanation of responsive design, and how media query comes into play and designing a responsive webpage.

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

Sidebar

Related Questions

Can someone please explain this? As I understand it provides less precision..Is it a
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can someone please explain why this is happening? This is expected: $ echo -e
Can someone please explain why I'm getting this error Type mismatch: cannot convert from
I have a feeling this XML is not valid, can someone please explain why?
Could someone please help explain why I can't get this to work? I properly
Can someone please explain why this code is not outputting a value for $consultant
I have regex which reads: @<img\s*[^>]*>(?:\s*?</img>)? Can someone please explain this part: (?:\s*?)? What
Can someone please explain this to me? I have the following code: <form action=<?php
I am not too familiar with javascript. Can someone please explain this construct 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.