phpcsssassinlinenette

Can you do math operations with inline style values or use SASS to do math operations with inline CSS?


Due to my php code (nette framework) being dynamic, I use some inline styling.

<div id="parent" style="height:{$place->getHeight()}px; ">

This creates a problem for me as I need the children divs to retake this parent div's height and divide it by 3.

Is there any way to do this with inline styling? E.g.:

<div id="child" style="height:({$place->getHeight()}/3)px; ">

Basically can you do something like style="height:(9/3)px"

Or is there some SASS / SCSS alternative to acomplish this?

Thank you for your time and wisdom.


Solution

  • U should use calc().

    style="height: calc(<?=$place->getHeight()?>/3)px;"