-
1. Explain What Is Less?
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. Explain How To Create Less File And Where To Store It And Compile It?
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. In What Ways Less Can Be Used?
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
-
4. How Variable Is Represented In Less?
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.
-
5. Explain How Mixins Is Useful?
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.
-
6. Explain How Can Set Code In A Watch Mode When You Run Less.js In An Html5 Browser?
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.
-
7. Explain What Is The Meaning Of Nesting In Less Programming?
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.
-
8. Mention What Are The Color Channel Functions Used In Less?
color channel function used in LESS are as:
- hue
- saturation
- hsvhue
- saturation
- hswalue
- red
- green
- blue
- alpha
- luma
- luminance
-
9. Explain What Is Data-uri In Less?
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
-
10. Explain What “source Map Less Inline”?
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.
-
11. Explain What Is The Use Of Extend “all” In Less?
When you specify all keyword last in an extend argument, it tells LESS to match that selector as part of another selector.
-
12. Explain What Is “strictimports” In Less?
The strictImports controls whether the compiler will allow a @importinside of either @media blocks or other selector blocks.
-
13. List Out The Differences Between Less And Sass?
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.
-
14. What Are The Similarities Between Less And Sass?
Between LESS and Sass the similarities are:
- Namespaces
- Color functions
- Mixins and parametric mixins
- Nesting capabilities
- JavaScript evaluations
-
15. Explain What Is The Use Of &combinator?
&combinatorconcatenates nested selector with the parent selector. It is useful for Pseudo classes such as :hover and :focus.
-
16. Explain What Is The Use Of Operations In Less?
Operations can be used for performing functions like:
- Simple Mathematical operators: +, – , *, /
- Color functions
- Math functions
- Any size or color variable can be operated upon.
-
17. Explain What Is The Use Of Escaping?
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
-
18. What Does Less Elements Contains?
Less elements contain commonly used mixins like:
- .gradient
- .rounded
- .opacity
- .box-shadow
- .inner-shadow
-
19. List Out Alternatives Against Less?
- SASS: Syntactically Awesome Stylesheets
- SCSS: Version.2 of SASS
- Stylus
-
20. Explain How You Can Invoke The Compiler From The Command Line?
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
-
21. What Is The Use Of E () Function?
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.
-
22. Explain How You Can Pre-compile Less Into Css?
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 compilerLess. app (for Mac users):
Less.app is a free tool for Mac users, this tool auto compiles them into CSS files. -
23. Explain How Merge Function Is Used In Less?
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.
-
24. How Can You Create A Loop Structures In Less?
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;
} -
25. Why Do We Need Parametric Mixins In Less?
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.
CSS3 Interview Questions
CSS3 Tutorial
HTML Interview Questions
HTML Tutorial
HTML 5 Interview Questions
EJB(Enterprise JavaBeans) Interview Questions
HTML 5 Tutorial
Angular JS Interview Questions
CSS3 Interview Questions
EJB(Enterprise JavaBeans) Tutorial
IBM Sterling Order Management V9.1, Deployment Interview Questions
Git (software) Tutorial
Git (software) Interview Questions
HTML Interview Questions
CSS Advanced Tutorial
CSS Advanced Interview Questions
SASS (Syntactically Awesome Style sheets) Tutorial
SASS (Syntactically Awesome Style sheets) Interview Questions
HTML 5 Interview Questions
JAVA Persistence API (JPA) Tutorial