Arithmetic - don't understand squared units 4/9


Can someone please explain what the following means. I don’t understand why I won’t get 100px if I multiply 10px * 10px and it will throw an error. If I’m multiplying 6px * 7px = 42px surely 10px * 10px = 100px. I’m obviously missing something.

"Also, just like in regular math, multiplying two units together results in squared units: 10px * 10px = 100px * px.

Since there is no such thing as squared units in CSS, the above would throw an error. You would need to multiply 10px * 10 in order to obtain 100px."


Let me use your example: 6px * 7px would not give you 42px, it would give you 42px2, which is nonsensical, as px2 isn’t a valid unit. 10px * 10px would give you 100px2, not 100px.

I feel like that lesson should use superscripts to make it more obvious what’s going on and why multiplying px together is not valid.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.