Chapter 5. Inheritance, Overriding, and Nesting in Less

So far in our journey with Less, we've seen how you can begin to reduce the code you need to write; it's time to take it up a level and begin to look at some more advanced concepts within Less.

Let me begin by asking you a question: what is the one thing that irritates you about writing styles where the same selector has to be repeated many times, such as when designing a menu system using an unordered list element? Hopefully, the answer is duplicated styles. In this chapter, we will take a look at how you can group styles to avoid the need to duplicate selectors in your code. We will also cover how you can inherit styles that can have a dramatic effect on reducing duplication; I'll also provide ...

Get Learning Less.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.