css - Can someone help explain how the css3 calc() method actually works? -


I am working on a library that converts CSS 3 methods into CSS 2 is. A difficult part is math. The proposal of the CSS 3 (Calc) method blows my brain too much ..

I make parax / split / subtract / multiply from EMS or any other fixed unit Enabled, but I do not have any clue how to add 10px to 60%.

Say that you have variable setup: $ width1 = 10px; And $ width = 50%;

Width:

Is there any way to do this kind of mathematics so that fixed width values ​​can be applied to older browsers? Maybe CSS expression is being used as Fallback?

With my best guess, you can not do that because CSS3 added that functionality, Because CSS 2 could not do it on its own. There are many CSS frameworks that add functionality as far as unit conversion occurs, you have to make a decision about your priority using your example:

$ width1 = 10px $ width2 = 50 Assuming (for this example) a 500px screen, if you take the percentage priority, you will first have a block that is 250px, in which you add 10px, resulting in 260px. If you go to the other side, then it will be 250 px. (It is believed that auto gives priority to everyone, so auto + 10 px, its 50% parent container).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -