Using a module in css calc function

Is there a way to use or implement a module statement in a css calc function?
I know that there is a mod statement, and IE supports it, but what about other browsers?

for instance

#element-id{
     width: calc( 100%  mod 5 );
}
+2
source share
3 answers

Unfortunately, the statement is no longer mentioned modin the latest specifications .

The calc () function allows you to use mathematical expressions with the addition of (+), subtraction (-), multiplication (*) and division (/) as component values.

You can resort to using javascript to achieve this behavior.

var el = document.getElementById('element-id');
el.style.width = (100 % 5) + '%';
+1
source

... "NO".

MDN

, , :

+ .

- .

* . <number>.

/ . <number>.

+3

Only Internet Explorer supports the mod feature, I'm afraid, and this has been excluded from the CSS specification , so other browsers are not likely to support it any time soon.

0
source

Source: https://habr.com/ru/post/1651204/


All Articles