hcker2000
hcker2000

Reputation: 615

Using & inside Less mixins

Here is my mixin code

.bleed() {
    &:before, &:after {
        content: " ";
        width: 3%;
        height: 100%;
        display: block;
        .horizontal-gradient(none, #000, rgba(0,0,0,0.0));
        float: left;
    }

    &:after {
        .horizontal-gradient(none, rgba(0,0,0,0.0), #000);
        float: right;
    }
}

Here is the code I'm calling it from.

.my-class {
   .bleed();
}

I'm hoping there is some way to do some thing like .bleed(&); to pass the current selector to the mixin? Right now it is just crashing and not creating the css.

Upvotes: 0

Views: 105

Answers (1)

hcker2000
hcker2000

Reputation: 615

The code does work as is. There was a spelling mistake locally.

Upvotes: 1

Related Questions