Percentage details--Container size article _ Experience Exchange

Source: Internet
Author: User
Because the smallest unit that the screen can display is 1px, there must be some trade-offs with the length of the number such as 773*50%=386.5.

Test page, some browser's label width is also inside

IE: Calculated by rounding.

Firefox: The calculated value ignores the fractional part, but assigns the extra length to the elements inside. If only 1px, such as 2*386=772, the remaining 1px will go to one of the elements, the first element is assigned precedence, like 773px assigned to two 50% when it is: 387px and 386px, assigned to the four 25% when the resulting is: 194px, 193px, 193px and 193px, and for more than a few px, such as 773*33.3%=257.409,773*33.33%=257.6409, due to ignore the decimal is not the same, the principle of distribution is not the same, find the relevant information, the following is my guess, three elements, By rounding the allocation, the priority of the four to the two sides, five into the priority assigned to the front two, for the allocation of more than three elements, more free distribution, I can not find the rule, but the first will definitely be assigned to.

FF also has some strange places. Firefix test page. 1024 width is not automatically assigned, perhaps because the outer layer is also with a decimal, resulting in 1px is not assigned, and then test Firefox

Opera & Safari2: Ignores the fractional part of the calculation, the calculated value ignores the decimal portion, and if the element inside is larger than the calculated width does not cause subsequent elements to wrap.

Netscape & Mozilla: After the calculation ignores decimals, the extra part is somewhat similar to Firefox, but the more out of the part is more than transparent display, and more strange, such as 33.33%*3=99.99% less than 100%, but more than 100%, Strange browser, Fortunately, not many people use, do not care too much about these two browsers.

Test is not completed, interested friends to help test, separate test page, have to know the reason for the friend to tell the next
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.