Width of the html parent element (calculated using 1$(el).width()1) is less than the combined width of child elements.
- Happens only in Firefox.
Any idea why this could be happening ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably, total width is a sum of widths and these fractional widths were previously rounded in some way. This sum is not equal to width of container. I found that more elements produce more inaccuracy e.g. 3 pixels difference for 5 elements.
Actualy, inline text block can have fractional width, for example 10.6px . So, three of those blocks placed in a row will take 31.8px ≈ 32px. But when each width rounded to ≈ 11px * 3 = 33px in total. Here is the one pixel defference. http://jsfiddle.net/3BFGU/86/
n.b. Firefox’ font rendering engine start to use subpixel letter placement only when font-size > 15px (for at least Verdana, Arial and Segoe UI, which have extreme hinting applied). When less every letter have integer width value and all same letters in the string have exactly same raster image. This behaivior clearly seen with
letter-spacing: .9px;and switching betweenfont-size: 14.9px;andfont-size: 15.1px;Besides that, a year ago I made a little playground to test rendering engines of different browsers.