R
R
retyui2017-02-22 17:36:38
css
retyui, 2017-02-22 17:36:38

How can I calculate the remainder of a division using the CSS calc() function?

https://developer.mozilla.org/ru/docs/Web/CSS/calc
need to implement such a perversity

♥{
   left: calc(100% % 69px); /* :(   */
}

Is it possible to use simple arithmetic operations +,-,*,/ to get the remainder of a division?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sticher78, 2017-03-02
@Sticher78

So it makes it difficult to calculate these same 69px through a proportion and set it in calc (100% / 6), or how much you get there.
You yourself point to the link to the specification, and it says that only the numerical value of the divisor can be.
In the same way, you can specify both the width of the block and its margin.
Well, or solve this issue through js or scss.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question