Less (stylesheet language) Interview Questions & Answers

  1. Question 1. Explain What Is Less?

    Answer :

    LESS is dynamic style sheet producing language. LESS is a CSS pre-processors and extends CSS with dynamic behavior. It allows for variables, mixins, operations and functions. LESS runs on server side and client side both.

  2. Question 2. Explain How To Create Less File And Where To Store It And Compile It?

    Answer :

    Creating or storing LESS file is similar to creating/storing CSS file. A new LESS file can be created with a .less extension, or you can rename existing .css file to .less file. You can write LESS code with existing CSS code.

    The best way of creating it inside ~/content/ or ~/Styles/ folder.

  3. CSS3 Interview Questions

  4. Question 3. In What Ways Less Can Be Used?

    Answer :

    Following are the ways :

    • Via npm LESS can be used on the command line
    • Download as a script file for the browser
    • For third party tools, it is used
  5. Question 4. How Variable Is Represented In Less?

    Answer :

    LESS allows variables to be defined. In LESS, the variable is represented as @ sing. While, variable assignment is done with a : (colon) sing. The values of the variables are inserted into the CSS output file as well as minified file.

  6. CSS3 Tutorial

  7. Question 5. Explain How Mixins Is Useful?

    Answer :

    Mixins enable embedding all the properties of a class into another class by including the class name as one of its properties. It is just like variables but for whole classes.

  8. HTML Interview Questions

  9. Question 6. Explain How Can Set Code In A Watch Mode When You Run Less.js In An Html5 Browser?

    Answer :

    If you run LESS.js in an HTML5 browser, it will use local storage to cache the generated CSS. However, from the developer point of view they cannot see the changes they made instantly. In order to see your changes instantly, you can load program in development and watch mode by following JavaScript.

  10. Question 7. Explain What Is The Meaning Of Nesting In Less Programming?

    Answer :

    Nesting in LESS is clustering of statements inside other statements, so it forms a group of related code. In other words when we add a code snippet and add another code inside it, then that code snippet is called nesting.

  11. HTML Tutorial
    HTML 5 Interview Questions

  12. Question 8. Mention What Are The Color Channel Functions Used In Less?

    Answer :

    color channel function used in LESS are as:

    • hue
    • saturation
    • hsvhue
    • saturation
    • hswalue
    • red
    • green
    • blue
    • alpha
    • luma
    • luminance
  13. Question 9. Explain What Is Data-uri In Less?

    Answer :

    In CSS, Data URI’sis one of the best technique, it allows developers to avoid external image referencing and instead embed them directly into a stylesheet. Data URIs are the excellent way to reduce HTTP requests

  14. EJB(Enterprise JavaBeans) Interview Questions

  15. Question 10. Explain What “source Map Less Inline”?

    Answer :

    The “Source Map Less Inline” option indicates that we should include all of the CSS files into the sourcemap. Which means that you only need your map file to get to your original source.

  16. HTML 5 Tutorial

  17. Question 11. Explain What Is The Use Of Extend “all” In Less?

    Answer :

    When you specify all keyword last in an extend argument, it tells LESS to match that selector as part of another selector.

  18. Angular JS Interview Questions

  19. Question 12. Explain What Is “strictimports” In Less?

    Answer :

    The strictImports controls whether the compiler will allow a @importinside of either @media blocks or other selector blocks.

  20. CSS3 Interview Questions

  21. Question 13. List Out The Differences Between Less And Sass?

    Answer :

    Each style-sheet language is good in their perspective and use; however there are few differences in their usage.

    LESS

    • LESS uses JavaScript and processed at client-side
    • Variable names are prefaced with the @symbol
    • LESS does not inherit multiple selectors with one set of properties
    • LESS does not work with “unknown” units neither it returns syntax error notification for incompatible units or math’s related syntax error.

    Sass

    • Sass is coded in Ruby and thus processed to server-side
    • Variable name are prefaced with $ symbol
    • Sass inherits multiple selectors with one set of properties
    • Sass allows you to work with “unknown” units also returns a syntax error notification for incompatible units.
  22. EJB(Enterprise JavaBeans) Tutorial

  23. Question 14. What Are The Similarities Between Less And Sass?

    Answer :

    Between LESS and Sass the similarities are:

    • Namespaces
    • Color functions
    • Mixins and parametric mixins
    • Nesting capabilities
    • JavaScript evaluations
  24. Question 15. Explain What Is The Use Of &combinator?

    Answer :

    &combinatorconcatenates nested selector with the parent selector. It is useful for Pseudo classes such as :hover and :focus.

  25. IBM Sterling Order Management V9.1, Deployment Interview Questions

  26. Question 16. Explain What Is The Use Of Operations In Less?

    Answer :

    Operations can be used for performing functions like:

    • Simple Mathematical operators: +, – , *, /
    • Color functions
    • Math functions
    • Any size or color variable can be operated upon.
  27. Git (software) Tutorial

  28. Question 17. Explain What Is The Use Of Escaping?

    Answer :

    Following are the use of escaping in LESS:

    • When you need to output CSS that is not valid CSS syntax
    • Proprietary syntax not recognized by LESS
    • LESS compiler will throw an error if not used
    • Simple prefix with ~ symbol and put in quotes
  29. Git (software) Interview Questions

  30. Question 18. What Does Less Elements Contains?

    Answer :

    Less elements contain commonly used mixins like:

    • .gradient
    • .rounded
    • .opacity
    • .box-shadow
    • .inner-shadow
  31. HTML Interview Questions

  32. Question 19. List Out Alternatives Against Less?

    Answer :

    • SASS: Syntactically Awesome Stylesheets
    • SCSS: Version.2 of SASS
    • Stylus
  33. CSS Advanced Tutorial

  34. Question 20. Explain How You Can Invoke The Compiler From The Command Line?

    Answer :

    You can invoke the compiler from the command line in LESS as

    $ lessc styles.less

    This will output the compiled CSS to stdout; you may then redirect it to a file of your choice

    $ lessc styles.less > styles.css

  35. CSS Advanced Interview Questions

  36. Question 21. What Is The Use Of E () Function?

    Answer :

    With the help of e()function you can escape a value so that it passes straight through to the compiled CSS, without being noticed by the LESS compiler.

  37. Question 22. Explain How You Can Pre-compile Less Into Css?

    Answer :

    To pre-compile LESS into CSS you can use:

    Run less.js using Node.js : By using the Node.js JavaScript framework you can run the less.js script outside the browser.

    Use lessphp: For the implementation of the LESS compiler written in PHP, lessphp is used.

    Use online Compiler: Use online compiler for quick compilation of LESS code without installing a compiler

    Less. app (for Mac users): Less.app is a free tool for Mac users, this tool auto compiles them into CSS files.

  38. SASS (Syntactically Awesome Style sheets) Tutorial

  39. Question 23. Explain How Merge Function Is Used In Less?

    Answer :

    For aggregating values from multiple properties into a space or comma separated list under a single property LESS is used. It is useful for properties such as transform and background.

  40. SASS (Syntactically Awesome Style sheets) Interview Questions

  41. Question 24. How Can You Create A Loop Structures In Less?

    Answer :

    A mixin can call itself in LESS. Such recursive mixins, when combined with Pattern matching and Guard Expressions, can be used to create various iterative/loop structures.

    Example:

    .loop(@counter) when (@counter > 0) {
      .loop((@counter – 1));    //
    next iteration
      width: (10px * @counter); // code for each
    iteration
    }
    div {
      .loop(5); // launch the loop
    }
    Output:
    div {
      width: 10px;
      width: 20px;
      width: 30px;
      width: 40px;
      width: 50px;
    }

  42. HTML 5 Interview Questions

  43. Question 25. Why Do We Need Parametric Mixins In Less?

    Answer :

    Parametric mixinsare same like standard mixins. The only difference is that parametric mixins take parameters like functions in JavaScript. After determining parameters to the mixins, you get more control over mixins.

  44. JAVA Persistence API (JPA) Tutorial