I know i can do calc(100% + 15px)
, but is there way to do
calc("content width" + 15px)?
fit-content and auto didn't work, which kinda makes sense.
I have unknown number of items that i want just to take width they need (inline-block) + some amount of px for justify-content: space-between;
If this can't be done with calc, is there an alternative?
(I'm using scss if that changes anything)
Use padding. The content+padding => determines size without using % percentage for width.
In my scenario, a button added a '>' using pseudo ::after, and was positioned 18px from the right edige.
I also found myself in this situation, unfortunately not having found a solution I used a small JS function that assigns the value
width: calc ($(element).width() + 10px);
Unfortunately, rather than calculating the measure via javascript when loading the page I can not help you.
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