Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If, for example, you're using a <code>%</code> width, and the exact width should be <code>103.333px</code>, then the browser must make a decision on how display that.</p> <p>Different browsers make different decisions, read these links for more information:</p> <ul> <li><a href="http://ejohn.org/blog/sub-pixel-problems-in-css/" rel="nofollow noreferrer">http://ejohn.org/blog/sub-pixel-problems-in-css/</a></li> <li><a href="http://elasticss.com/determination-of-algorithms-used-for-percentage-based-rounding-divs-on-browsers-and-css-frameworks/" rel="nofollow noreferrer">http://elasticss.com/determination-of-algorithms-used-for-percentage-based-rounding-divs-on-browsers-and-css-frameworks/</a></li> </ul> <p>I particularly like this explanation from John Resig/David Baron of why this is even a problem:</p> <blockquote> <p>I was talking this over with some Mozilla developers and David Baron explained the situation quite well:</p> <p><strong>We’re trying to meet a bunch of constraints that can’t all be satisfied at the same time</strong> (the proof is left as an exercise to the reader, though I may have actually written it out once in a Bugzilla comment):</p> <ol> <li><p>4 adjacent objects of width/height 25% (for example) starting at one edge of a container should end exactly at the other edge; there should never be an extra pixel in the container and they should never be wrapped due to being a pixel to wide</p></li> <li><p>objects that are logically adjacent should always touch visually; there should never be a pixel gap or a pixel of overlap due to rounding error</p></li> <li><p>objects given the same width should occupy the same number of pixels</p></li> <li><p>object boundaries should always (visually) be aliased to a specific pixel boundary in the display (they should never be blurred)</p></li> </ol> <p>The one [Mozilla] sacrifices is typically (3), except for borders where we sacrifice (1) by rounding the widths to pixel boundaries much earlier.</p> </blockquote> <p>See this question for a JavaScript fix that forces consistency:</p> <p><a href="https://stackoverflow.com/questions/5115637/evenly-distributed-height-of-child-elements-with-css">Evenly distributed height of child elements with CSS</a></p> <p>Another relevant question:</p> <p><a href="https://stackoverflow.com/questions/4308989/are-the-decimal-places-in-a-css-width-respected">Are the decimal places in a CSS width respected?</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload