w3c/csswg-drafts
Voir sur GitHub[cssom-view] Layout dimension that divides+rounds+sums to value different to original dividend
Open
#1 211 ouverte le 13 avr. 2017
Help Wantedcssom-view-1
Métriques du dépôt
- Stars
- (3 546 stars)
- Métriques de merge PR
- (Merge moyen 87j 7h) (24 PRs mergées en 30 j)
Description
Is there any specification for HTML layout dimensions that divide, round and sum to a value greater than the original dividend?
For example
- A container has two columns.
- Both columns are 50% the width of the parent.
- The width of the container is 9 pixels.
- How wide should each column be?
Major web browsers handle this differently;
| Browser | First | Second | element.offsetWidth |
Aliases † |
|---|---|---|---|---|
| Chrome | 5 | 4 | 5 and 4 respectively | No |
| Safari | 5 | 4 | 5, even for the 4px column | No |
| Firefox | 4.5 | 4.5 | rounded to 5 | Yes |
| Edge | 4.5 | 4.5 | rounded to 5 | Yes |
† Allows element boundaries to be mid-pixel, causing that pixel to be aliased based on the two elements that it straddles.

Test cases
The specification for offsetWidth only says that offsetWidth must be an integer. Is this specified elsewhere? Should it be?
Is this the correct place to discuss?