"html" element viewport width not adjusted when pagesize is set to landscape in a named @page (unnamed works ok)
florimon opened this issue · 3 comments
Hi, first of all thanks for creating an amazing utility.
I ran into the following issue though, here is my 'testcase' html in condensed form:
<html lang="en" class="landscape">
<head>
<style>
@page portrait {
size: a4 portrait;
}
@page landscape {
size: a4 landscape;
border: 5px solid red;
}
html.portrait {
page: portrait;
}
html.landscape {
page: landscape;
}
html {
height: 100%;
border: 5px solid green;
}
</style>
</head>
<body></body>
</html>
By putting a 'landscape' CSS class on the "html" element, the "@page landscape" rule is activated, which is evidenced by the produced PDF being in landscape mode, and the page having a thick red border box.
Inside this red box however is a much narrower green box around the "html" element - I would have expected this to align on all sides to the red box instead. When you change the "@page landscape" selector to just "@page", the green box does indeed have the same width as the red box.
I'm experiencing the same. Is there a solution for this?
Why not just apply the styles to the body element? Is there a reason why that doesn't work?