vh & vw units are too large (and depend on DPI), in printed / print-previewed documents
Categories
(Core :: Layout, defect, P3)
Tracking
()
People
(Reporter: dholbert, Unassigned)
References
Details
(Whiteboard: [print2020])
Attachments
(5 files)
STR:
- View attached testcase.
- Print-preview or print.
EXPECTED RESULTS: The two black boxes should be the same size (they should both be 15% of the page's width).
ACTUAL RESULTS: The one that uses vh
is too big. It seems vh
units are being scaled up by some factor.
The unexpected scale-up factor seems to depend on my DPI.
- In print-preview with my monitor configured for 100% dpi scaling, the
vh
box is about 2.5x as big as I'd expect. - In print-preview with my monitor configured for 200% dpi scaling, the
vh
box is about 5-6x as big as I'd expect. - In print-to-pdf, the
vh
box is about 1.2x as big as I'd expect (only slightly larger)
Reporter | ||
Comment 1•4 years ago
|
||
Here's a screenshot taken on dholbert's dell XPS laptop, with Ubuntu resolution settings at 100% scale
Reporter | ||
Comment 2•4 years ago
|
||
Here's a screenshot taken on dholbert's dell XPS laptop, with Ubuntu resolution settings at 200% scale
Reporter | ||
Comment 3•4 years ago
|
||
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 4•4 years ago
|
||
Note 1: bug 909780 has a similar description, but it apparently required "a big font-size (> 300px)" so it may be a different issue. --> adding to "see also.
Note 2: this issue (in part) causes our internal page about:rights
to fail to print, since that page uses a min-height:100vh
flex container whose contents are vertically centered via flex properties. The 100vh height ends up being huge, so the contents don't show up, via bug 939897.
Updated•4 years ago
|
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment hidden (obsolete) |
Comment 8•4 years ago
|
||
Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3
(Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3
(normal.)
Comment 9•3 years ago
|
||
Here's a testcase that shows our viewport units are incompatible with Chrome.
When I print this on a printer I see "Hello" clipped vertically about halfway through the text in both Chrome/Firefox, so it appears @page { margin:0; }
behaves the same, but I see the right/bottom borders about 3cm in from the edges of the paper in Firefox. Chrome clips the border on all sides so it's not visible at all. I'm guessing our vw/vh
units aren't affected by the @page
margin at all? whereas Chrome does take it into account?
Comment 10•3 years ago
|
||
@emilio, I seem to recall you were discussing viewport units on some CSSWG forum a while back? Was there any consensus on how these should work (in print mode or otherwise)?
Comment 11•3 years ago
|
||
See https://github.com/w3c/csswg-drafts/issues/5437, yes.
Chrome does take @page
into account while we don't. Doing that generally would cause cycles, and it's not clear what the best way to deal with those is. So I think that our behavior here is generally reasonable now.
Comment 12•3 years ago
|
||
Thanks, I think that's the one I saw. Thanks for filing that and summarizing what various UAs do there! I hope we can reach consensus on that because it kind of sucks that authors have to deal with different behavior currently.
Description
•