Groups > Browsers > Opera Browser Page display > Re: CSS percentage widths truncated?




CSS percentage widths truncated?

CSS percentage widths truncated?
Thu, 03 Apr 2008 22:58:27 -070
It seems like Opera truncates CSS percentage widths: i.e.

width: 15.61%

is interpreted as

width: 15%

This seems like a problem; if I have a container of, say, 1000px then  
truncating percentages like this could cause errors of up to 9 pixels.   
Shouldn't the percentage be applied to the length first, and then that  
value be rounded or truncated?

Thanks,
Jeremy

-- 
Post Reply
Re: CSS percentage widths truncated?
Fri, 04 Apr 2008 09:44:41 +010
On Fri, 04 Apr 2008 06:58:27 +0100, Jeremy <jeremy@pinacol.com> wrote:

> It seems like Opera truncates CSS percentage widths: i.e.
>
> width: 15.61%
>
> is interpreted as
>
> width: 15%

Yes, Opera interprets most values as integers rather than rounding them. I  
don't know if they've changed this behaviour in 9.5. I've also found it a  
bit annoying over the years, but just accept that Opera may be a few  
pixels different on the rare occasions I need to use floating point values  
for percentage widths.

Opera has traditionally parsed integers when computing most values,  
something which I think goes back to the days of slow computers and  
simpler rendering engines to help prevent layouts breaking under certain  
circumstances, but I'm not sure if percentages were always supposed to be  
part of that or were an oversight. Either way, I don't see any reason why  
Post Reply
about | contact