rashidfarooq Posted May 7, 2011 Share Posted May 7, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/235781-why-opera-does-not-accept-measuring-units-in-decimal-points/ Share on other sites More sharing options...
sunfighter Posted May 8, 2011 Share Posted May 8, 2011 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? 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. Quote Link to comment https://forums.phpfreaks.com/topic/235781-why-opera-does-not-accept-measuring-units-in-decimal-points/#findComment-1212127 Share on other sites More sharing options...
fugix Posted May 8, 2011 Share Posted May 8, 2011 Honestly decimal percentages work for me in ff. But I'm not sure if it just takes the decimal and rounds it. Too small to tell. But I would recommend using either pixels of em's Quote Link to comment https://forums.phpfreaks.com/topic/235781-why-opera-does-not-accept-measuring-units-in-decimal-points/#findComment-1212218 Share on other sites More sharing options...
rashidfarooq Posted May 8, 2011 Author Share Posted May 8, 2011 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? 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. Quote Link to comment https://forums.phpfreaks.com/topic/235781-why-opera-does-not-accept-measuring-units-in-decimal-points/#findComment-1212232 Share on other sites More sharing options...
sunfighter Posted May 8, 2011 Share Posted May 8, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/235781-why-opera-does-not-accept-measuring-units-in-decimal-points/#findComment-1212443 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.