Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect positioning in page area with @page with padding #1447

Open
MurakamiShinyu opened this issue Jan 24, 2025 · 0 comments
Open

Incorrect positioning in page area with @page with padding #1447

MurakamiShinyu opened this issue Jan 24, 2025 · 0 comments
Assignees
Labels

Comments

@MurakamiShinyu
Copy link
Member

Absolute-positioned elements are positioned incorrectly in the page area with @page with non-zero padding. The page area that is the initial containing block must be the content box of the page box, but it seems that the absolute-positioned elements are positioned as if the initial containing block is the padding box of the page box.

Example:

<style>
@page {
  size: 500px;
  margin: 50px;
  border: 10px dotted blue;
  padding: 40px;
}
* {
  margin: 0;
}
.absolute-box {
  position: absolute;
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  background: magenta;
}
.static-box {
  width: 150px;
  height: 150px;
  background: orange;
}
</style>
<div class="absolute-box">Absolute</div>
<div class="static-box">Static</div>

(page-area-padding-position.html)

Test with Vivliostyle Viewer (v2.31.0):

Screenshot:

Image

Expected result:
(This is a screenshot of the same HTML file rendered in Chrome's print preview.)

Image


This problem is not only with the absolute positioning but also with page floats and footnotes.

Example: page-box-padding-test.html

Test with Vivliostyle Viewer (v2.31.0):

Screenshot:

Image

Extected result:
(This is a screenshot of the same HTML+CSS rendered by Antenna House Formatter using https://printcss.live/editor.)

Image

@MurakamiShinyu MurakamiShinyu self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant