nerdburn
nerdburn

Reputation: 712

Using LESS CSS, can I multiple a "property" by an amount? For example: width x 1.26?

Here's my CSS:

        div {
        border: 0;
        display: block;
        width: 100%;
        height: width * 1.26411765;
    }

I'd like "width" to be the current pixel width of the element. Does that make sense? Is this possible?

Upvotes: 0

Views: 135

Answers (1)

Gary Willoughby
Gary Willoughby

Reputation: 52588

Use something like

div {
    border: 0;
    display: block;
    width: @div-width;
    height: (@div-width * 1.26411765);
}

See: http://lesscss.org/#-operations

EDIT: Having just read your question properly (oops) you can access javascript from less to get values. See the link above and scroll further down the page. I've never actually tried it though.

Upvotes: 1

Related Questions