This is a question that has been asked several times before, but none of the answers I have found seem to work in my case. I have 3 buttons and I am trying to evaluate their width as follows:
.num-buttons-3 {
width: calc((100% - 40px)/3);
}
This always evaluates in my browser (Chrome) as 20%, which is (100% - 40%)/3
.
I have tried numerous suggested alternatives to get this to evaluate correctly, such as:
.num-buttons-3 {
width: calc((~'100% - 40px')/3);
}
.num-buttons-3 {
@marg: 40px;
width: calc((~'100% - @{marg}')/3);
}
Is therer another CSS or LESS solution I can try?
Found an answer on this. Escaping the entire calc function is an option that seems to work:
width: ~"calc(((100% - 40px)/3))";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With