Skip to content

Negative calculated value lose its unit #2471

Closed
@MatTheCat

Description

@MatTheCat
@font-size-base: 1em;
@atomic-distance-base: unit(5/8, em);

@line-height-base: (ceil(@font-size-base/@atomic-distance-base)*(@atomic-distance-base/@font-size-base));

If I write margin: @line-height-base; I get margin: 1.25em; as expected. margin: (@line-height-base*2); get me margin: 2.5em; too.

But get-unit(@line-height-base) echoes an empty value and the unit is removed if the result of an operation with this value is negative. Eg. margin: (1 - @line-height-base); will generate margin: -0.25;

I guess it's logical the unit is lost after a division but why is it still there in some case?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions