Is nesting possible with the &:extend function in LessCss?

I've recently been exploring the Less &:extend feature.

My goal is to nest multiple extends - essentially extending a class that itself extends another class.

However, after testing it out, I'm not sure if it's working as expected. It seems like the first extend works fine, but the second nested extend doesn't.

I've searched through the Less website and some reputable blogs, but I couldn't find any information on whether this is even possible.

Here's an example of what I'm trying to do:

.clearfix
{
    &:before,
    &:after {
        content: " ";
        display: table;
    }

    &:after {
        clear: both;
    }
}

.inline-list
{
    &:extend(.clearfix all);

    > li {
        float:left;
    }
}

.test
{
    &:extend(.inline-list all);
    // The clearfix class is not extended to test
}

Any advice or insights would be greatly appreciated.

Answer №1

After careful consideration, I made the switch from dotless to ServiceStack Bundler. This decision has allowed me access to all the newest features of Less. Personally, I recommend avoiding dotless since it does not receive regular maintenance updates and should not be relied upon as a viable option.

Answer №2

.example{ .inline-list; } Is this the result you're looking for, or am I still missing the mark?
You can effortlessly have a class inherit from another class by using the following syntax:

.newClass{ .parentClass; .secondParentClass; }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

CSS transitions following with visual/codepen

Does anyone know how to animate two images, bringing them to a central point before rotating them simultaneously? I'm struggling with transforming the svgs prior to starting the animation. Take a look at this example. My goal is to apply transform: r ...

Ensure that the icon at the conclusion of the <p> tag remains intact and does not break off on its

Issue at hand: The clock icons on my phone screen sometimes break off, see example here: https://i.sstatic.net/NQz9i.png Preferred outcome: The icons should be intact along with the time value, like this: https://i.sstatic.net/nZmC9.png Here is the H ...

Utilizing an Image as a Link in the Background

I am working on a way to convert the CSS background image I have into a clickable link that can be referenced. Here is my CSS code: #wrapper { height: 100%; padding: 66px; } #ad_11 { background-image: url(images/index1.png); display: block; text-indent: ...

Position Bootstrap Modal in the center horizontally

I am working on an Angular project and struggling to center my Bootstrap 3 Modal horizontally on the screen. Despite trying various solutions like using text-align: center and align = "center", I have been unsuccessful. Can someone guide me on how to prope ...

A textarea with a height of zero is still visible

My goal is to create collapsible widgets within a side panel on my webpage. Overall, the functionality works smoothly. I am able to adjust the height of child divs to 0px with a transition, causing them to disappear. However, I have run into an issue wher ...

The challenge of handling overflow in IE9

I'm encountering an issue specifically in IE9 where a child div is not respecting the overflow:hidden property of its container div. The outlined blue div in the image represents the container with overflow:hidden. The goal is for the images to stay w ...

Is there a way to adjust the scrolling speed of a background image to be slower than the rest of

I'm searching for an example similar to this: Are there any efficient javascript solutions available? I've had difficulty implementing the code I've come across so far. ...

Transition from Material UI styles to SCSS equivalent

Can you assist me in converting the following Material UI themes to its equivalent SCSS? I am defining up("sm") as meaning above600px. I'm in the process of creating a @mixin contentShiftContainer so that I can use it wherever needed. Howev ...

Customizing jQuery dialog: What is the best way to change the appearance of the close button?

I am struggling to style the close tag in my jQuery dialog box. I have looked through the documentation and tried various CSS alterations, but nothing seems to be working. Any suggestions or insights would be greatly appreciated. My code is provided below ...

I recently attempted a meyers reset and now I'm struggling to get my unordered list to display in a horizontal layout

Check out my code snippet below: .navbar-container { width:100%; display:inline-block; } ul { list-style-type: none; display: inline; } <div class="navbar-container"> <ul> <li><a href="gmail.com">Gmail</a>& ...

Flameflare/Console-inspired hover animation

Curious if there is a creative solution to this problem that I haven't thought of yet... I'm working on a site editor tool and it would be incredibly useful to have the ability to highlight elements when hovering over their code in the html/elem ...

CSS file selector for Reactstrap component

What is my goal? I noticed a gap between my jumbotron and footer that I want to remove. Initially, I was able to achieve this by setting the margin-bottom to 0px, but it required passing an ID to the Jumbotron element. Now, my objective is to accomplish t ...

Switch the Ionic Slide Box to the "does-continue" setting

Currently in the process of constructing a slide-box containing numerous items. I've borrowed the code from the example provided here for an infinite number of items, and it's performing well. However, I have a considerable yet finite amount of ...

Is it possible for URLs in CSS Custom Properties to be relative to the CSS file where they are defined?

I have a CSS library with resources like images and fonts that can be accessed from anywhere via CDN. I am trying to create URLs for these resources as Custom CSS Properties, relative to the library. <!-- https://my.server/index.html --> <link rel ...

How about having a surprise image pop up when you click a button?

I've been working on coding a button that can change the background of my webpage to display a random image. Initially, my code seemed functional, but it was only displaying the last image listed in my series of if/else statements. I suspect that usin ...

I am looking to implement a feature in my quiz application where a green tick mark appears next to the question number for the correct answer and a red cross mark for the wrong answer

My HTML code here retrieves questions from a database and displays them based on the question number. <h4>{{indexOfelement+1}}</h4>&nbsp;&nbsp; In my CSS, I need to style the questions as follows: How can I achieve this? Each question ...

Margins and borders with a negative impact

I have a collection of images that I am trying to stack using negative margins. However, because stacking them without defined boundaries can lead to visual confusion, I thought about adding borders around each image. Surprisingly, while the images are sta ...

I am experiencing an issue where the borders of a dropdown menu do not properly wrap around

I'm currently in the process of creating a dropdown menu that will display a list of articles along with the respective authors' images next to them. Initially, I intended to utilize Bootstrap 4's "card" system for this task. However, I enco ...

Formatting code within an HTML document

I am attempting to customize a stock widget that I obtained from financialcontent.com. My current approach involves using Bootstrap for styling purposes. To incorporate the widget into a div, I found it necessary to embed the script directly within the HT ...

What could possibly be causing this element to shift side to side (in IE only) during the CSS animation?

UPDATE: Issue occurring on Internet Explorer 10, Windows 7 When using the transform property to adjust the horizontal position of an element during animation, the vertical value is updated as well. However, despite setting the horizontal value to the same ...