Jump to content

Recommended Posts

I am using a CSS Style of such like

#col1
{
   width:3.6%;
   height:5.5%;
}

 

It works fine in Mozilla Firefox and Internet Explorer. But Opera Browser truncates the figures after decimal points and use only the values before the decimal points. (Mean it takes 3.6 as 3 and 5.5 as 5)

How can I control this issue?

A pixel is the smallest element that can be displayed on a screen. Percentages have to be translated into pixels to display what you want. 3.6% is awfully small in terms of pixels. If your taking 3.6% of 100 it's 3.6 pixels??  And what's .6 pixels? :shrug:  So some rounding out have to be done. If your setting a width of 3.6% of a display that's 800 pixels across, your value translates into 28.8 pixels and the browser can use 28 or 29  as the value. If Opera does in fact round the percent to 3% that's a value of 24 pixels, a difference of 4 pixels.

 

The work around = set things up in pixels (px) instead of percents when you need that great an accuracy.

A pixel is the smallest element that can be displayed on a screen. Percentages have to be translated into pixels to display what you want. 3.6% is awfully small in terms of pixels. If your taking 3.6% of 100 it's 3.6 pixels??  And what's .6 pixels? :shrug:  So some rounding out have to be done. If your setting a width of 3.6% of a display that's 800 pixels across, your value translates into 28.8 pixels and the browser can use 28 or 29  as the value. If Opera does in fact round the percent to 3% that's a value of 24 pixels, a difference of 4 pixels.

 

The work around = set things up in pixels (px) instead of percents when you need that great an accuracy.

 

I Thinks it is Browser rendering issue. Because I have used 0.3% width of a table cell and it works fine in Mozilla Firefox and Internet Explorer, But Opera can not handle it properly. I think only Opera does not render the decimal points. It takes only integer values, not the floating points.

I Thinks it is Browser rendering issue.

 

Yes it is. It has been with opera for a long time. Maybe they'll fix it soon, but for now we all have to live with it.  No known work around. Either you accept the different rendering or use pixels.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.