Sunday, 15 May 2011

css3 - CSS calc() not working -



css3 - CSS calc() not working -

is there limit how many operands can have within css calc() function?

this works:

class="lang-css prettyprint-override">div { left:calc((100%/54)*26); left:-webkit-calc((100%/54)*26); }

this not work:

class="lang-css prettyprint-override">div { left:calc(((100%/54)*14)-140px); left:-webkit-calc(((100%/54)*14)-140px); }

of course, latter need, because need offset few pixels, seek that, value seems go zero. insight appreciated!

thanks, michael m.

to quote mdn

the + , - operators must surrounded whitespace. operand of calc(50% -8px) instance parsed percentage followed negative length, invalid expression, while operand of calc(50% - 8px) percentage followed minus sign , length. * , / operators not require whitespace, adding consistency allowed, , recommended.

space stuff out, , work.

css3

No comments:

Post a Comment