Javatpoint Logo
Javatpoint Logo

Less Nesting

Nesting is used to make your code follow some visual hierarchy. It makes your code, simple, clean and less complex. You must be very careful while nesting because overly nested rules may cause complexity and it proves hard to maintain.

Let's take an example. Suppose you have to write a CSS code for a website which has three paragraphs, a standard paragraph, an intro paragraph and a highlighted paragraph. All the paragraphs are different in font size and caps. So you have to define all three differently.

For example:

CSS code:

Less nesting facilitates you to write the above CSS code in a nested manner where you don?t need to write the paragraph code repeatedly.

Equivalent Less file:

Next TopicLess Importing




Please Share

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials