Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CSS percentage widths truncated?

11 views
Skip to first unread message

Jeremy

unread,
Apr 4, 2008, 1:58:27 AM4/4/08
to
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

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Eik

unread,
Apr 4, 2008, 4:44:41 AM4/4/08
to
On Fri, 04 Apr 2008 06:58:27 +0100, Jeremy <jer...@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
Opera has needed to do this since at least version 7.

0 new messages