Less.js Maps-Using variable variables in lookups Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report LESS is a preprocessor of CSS that provide it with some more features to work and with the help of that, we can write more efficient CSS code. Let us have brief information about the lookups, it's just a pair of capital brackets [@lookups], the content inside the bracket is called lookups which are basically variables. Note that the value inside the brackets [@lookup] is not considered a variable, rather it will be considered a key value, so it will be used without @sign, unlike variables. In this article, we are going to learn about using variable variables in lookups, which is part of the less.js maps. Syntax: .selector[@@lookup] Parameter: It accepts variables as parameters, followed by the existing @ sign. Example 1: In this example, we will use the variable variables in lookups or [@@lookup] and change the color of the text. index.html: HTML <!DOCTYPE html> <html lang="en"> <head> <title>Maps - variable variables in lookups</title> <style> .change_color { color: green; } </style> </head> <body> <div class="change_color"> <h1>GeeksforGeeks</h1> </div> </body> </html> style.less: CSS .text-color-mixin() { @text_color: green; } @using-lookup: text_color; .change_color { color: .text-color-mixin[@@using-lookup] } Now, to compile the above LESS code to CSS code, run the following command: lessc style.less style.css The compiled CSS file comes to be: style.css: CSS .change_color { color: green; } Output: Example 2: In this example, we will use the variable variables in lookups to change the font sizes of the different texts with the help of lookups. index.html: HTML <!DOCTYPE html> <html lang="en"> <head> <title>Maps - variable variables in lookups</title> <style> .large_text { font-size: 50px; } .small_text { font-size: 20px; } .tiny_text { font-size: 10px; } p { color: green; } </style> </head> <body> <div class="large_text"> <p>GeeksforGeeks</p> </div> <div class="small_text"> <p>GeeksforGeeks</p> </div> <div class="tiny_text"> <p>GeeksforGeeks</p> </div> </body> </html> style.less: CSS .text-size-mixin() { @large-text: 50px; @small-text:20px; @tiny-text:10px; } @large-text-lookup:large-text; @small-text-lookup:small-text; @tiny-text-lookup:tiny-text; @text-color:green; .large_text { font-size: .text-size-mixin[@@large-text-lookup]; } .small_text { font-size: .text-size-mixin[@@small-text-lookup]; } .tiny_text { font-size: .text-size-mixin[@@tiny-text-lookup]; } p { color: green; } Now, to compile the above LESS code to CSS code, run the following command: lessc style.less style.css The compiled CSS file comes to be: style.css: CSS .large_text { font-size: 50px; } .small_text { font-size: 20px; } .tiny_text { font-size: 10px; } p { color: green; } Output: Reference: https://lesscss.org/features/#maps-feature-using-variable-variables-in-lookups Comment More infoAdvertise with us Next Article Less.js Maps-Using variable variables in lookups iamgaurav Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies Technical Scripter 2022 LESS Less.js-Functions +2 More Similar Reads Less.js Variables Properties as Variables LESS (Leaner Style Sheets) is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is a dynamic style sheet language that enhances the working power of CSS. LESS supports cross-browser compatibility. CSS pre-processor is a s 3 min read Less.js Variables Default Variables LESS (Leaner Style Sheets) is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is a dynamic style sheet language that enhances the working power of CSS. LESS supports cross-browser compatibility. CSS pre-processor is a s 3 min read Less.js Variables Overview The Variables in LESS.js govern the common values used in a single location, ie, they are known to keep values stored in them and can be used anywhere within the definition of code. LESS allows you to use these variables to change the specific value in the entire code. It might get troublesome when 2 min read Less.js Variables Multiple & Selector LESS (Leaner Style Sheets) is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is a dynamic style sheet language that enhances the working power of CSS. LESS supports cross-browser compatibility. CSS pre-processor is a s 3 min read Global and Local variables in JavaScript In JavaScript, understanding the difference between global and local variables is important for writing clean, maintainable, and error-free code. Variables can be declared with different scopes, affecting where and how they can be accessed. Global VariablesGlobal variables in JavaScript are those de 4 min read Less.js Options Rewrite URLs Less.js is a CSS pre-processor that allows developers to use variables, mixins, and other programming concepts in their CSS code. One of the useful features of Less.js is the ability to rewrite URLs in CSS, which can make it easier to manage and maintain large projects. This can be useful when migra 7 min read Less.js Browser Modify Variables LESS (Leaner Style Sheets) Â is an extension or superset to the CSS, which basically enhances the abilities of normal CSS and provides it with programmable superpowers like variables, functions, loops, various methods to do certain tasks, etc. In this article, we are going to take a look at updating 3 min read Less.js Variables LESS (Leaner Style Sheets) is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is a dynamic style sheet language that enhances the working power of CSS. LESS supports cross-browser compatibility. CSS pre-processor is a s 4 min read Less.js Lazy Variables Evaluation Less.js is a simple CSS pre-processor that facilitates the creation of manageable, customizable, and reusable style sheets for websites. It is a dynamic style sheet language that boosts the functionality of CSS. Cross-browser interoperability is offered via LESS. CSS is improved and compiled for usa 3 min read How to represent a variable in Less ? LESS stands for Leaner Style Sheets. It is a backward-compatible language extension for CSS. One of its features is that it lets you use variables in the style sheet. Variables can be used to store CSS values that may be reused. This makes it easier for the user by letting them define commonly used 2 min read Like