leafo/lessphp — Issue #182: round and floor returning integers
Author: cchana
Created: 2012-01-31 19:54:53+00:00
State: open

Using the round and floor methods simply returns an integer, which is OK and as intended, but if you're applying the methods to a property that's expecting a pixel value. An example is:

width: 500px / 11;

This would return *45.45px* and if I rounded that:

width: round(500px / 11);

This would return *45* which would cause my CSS layout to break (in firefox & chrome at least!)

To get around this, I've multiplied the rounded figure by 1px, which fixes the issue, but isn't ideal:

width: round(500px / 11) * 1px;

This works and returns *45px* and is a fix for now, but if a pixel value is passed in, a pixel value out would be great!