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

Floating figure intrudes before new section set to be break-before #1338

Open
yamahige opened this issue May 31, 2024 · 2 comments
Open

Floating figure intrudes before new section set to be break-before #1338

yamahige opened this issue May 31, 2024 · 2 comments
Labels

Comments

@yamahige
Copy link

The sections are set to ‘break-before: page;,’ but the figure from the previous section intrudes before the next section on a new page. How can I ensure that sections are displayed from the top of new pages, even if figures are set to ‘float: block-start; float-reference: page;’?

sample: https://gist.githubusercontent.com/yamahige/4077e9b3d8f6a067ee9e1fd8beb039b0/raw/882592611cd6e115ba8a933d75d37ae305547a86/new_page_floating_figure.html

Test with Vivliostyle Viewer : https://vivliostyle.org/viewer/#src=https://gist.githubusercontent.com/yamahige/4077e9b3d8f6a067ee9e1fd8beb039b0/raw/882592611cd6e115ba8a933d75d37ae305547a86/new_page_floating_figure.html

Result screenshot (version: 2.29.0):
result

expected:
expected

@MurakamiShinyu
Copy link
Member

I agree that the current behavior of page floats + forced page breaks is not very good and needs to be fixed.

A workaround is adding the following style:

section::after {
  content: "";
  display: block;
  clear: all;
}

Test with Vivliostyle Viewer:
https://vivliostyle.org/viewer/#src=https://gist.githubusercontent.com/yamahige/4077e9b3d8f6a067ee9e1fd8beb039b0/raw/882592611cd6e115ba8a933d75d37ae305547a86/new_page_floating_figure.html&style=data:,/*%3Cviewer%3E*/%0A/*%3C/viewer%3E*/%0Asection::after%20%7B%0A%20%20content:%20%22%22;%0A%20%20display:%20block;%0A%20%20clear:%20all;%0A%7D

About clear: all see https://docs.vivliostyle.org/#/supported-css-features#css-page-floats

  • clear
    • When all is specified on a block-level box (not a page float), the block-start edge of the box gets pushed down so that the edge comes after any block-start/block-end page float of which anchors are before the box in the document order.

@yamahige
Copy link
Author

yamahige commented Jun 3, 2024

I see.

A workaround is adding the following style:

Thank you!

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

2 participants