Gianpiero
Gianpiero

Reputation: 3557

How to override properties of a CSS class altering the original value (less + mixin)

Let's say I use bootstrap and what to override the padding-top of jumbotron class of a percentage using less and mixin

Is it possible to do something like this?

// this is my style.less file loaded *after* bootstrap.css
.jumbotron {
    padding-top: _original_padding-top_ * 0.5
}

Upvotes: 0

Views: 250

Answers (2)

seven-phases-max
seven-phases-max

Reputation: 11820

See https://github.com/twbs/bootstrap/blob/v3.3.7/less/jumbotron.less

So you simply do something like:

@import "bootstrap/variables.less";

.jumbotron {
    padding-top: @jumbotron-padding * .5;
}

}

Upvotes: 1

Arnau
Arnau

Reputation: 455

The percentage mixin only accepts one parameter, so what you propose is not possible.

See here. It's always good to check the reference documentation.

You will have to create your own mixin to do that.

Upvotes: 0

Related Questions