-
Notifications
You must be signed in to change notification settings - Fork 1
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
Box model #29
Comments
The problem with collapsing margins at the top of a page is that you can't get the following behavior (example from @joeha480):
and
For this reason we decided to drop that part for now. |
In order to get the following behavior:
and
we can make use of the fact that empty lines at the bottom of the page are suppressed: if we make the top margin of :has(+ h1) {
margin-bottom: 1;
} |
@bertfrees Nice! However, shouldn't it be margin-bottom: 1? |
Corrected. |
Making the top margin of an element into a bottom margin of the previous element indeed works with the above mentioned and similar css patches. There are, however, many corner cases which have to be taken into account. The majority of them are caused by a preceding pagenum element: as it is set to display:none in general, the following code will not create any margin below it. *:has(+ h1) { margin-bottom: 1; } Only this additional workaround will give the expected result: *:has(+ pagenum:has(+ h1)) { margin-bottom: 1; } The same applies to margins before paragraphs: they should not show at the beginning of a new page. If preceded by a pagenum element, this code can be used: *:has(+ pagenum:has(+ .precedingemptyline)) { margin-bottom: 1; } Nevertheless, the whole story gets more complex when there are not only one but multiple pagenum elements before the paragraph due to some empty pages or an illustration omitted in the source file. Then, each of the possible cases needs to be covered separately in the CSS. |
From this discussion it sounds like suppressing top margins at the start of a page would be a useful addition. Furthermore, some way of testing whether an element ends up at the top of the page would be useful, since e.g. pagenums shouldn't be displayed there (but they should be displayed inline in the text). |
I thought to be clever and added the margins to the element before the level, e.g.
... the |
For an explanation of why this is not done yet see discussion above. |
It looks like you could work around the problematic case with a |
Yes, going to work on this soon, see daisy/pipeline-mod-braille#97. |
Box Model
Anonymous Boxes
Collapsing Margins
The top and bottom margins of the root element's box and any adjoining margins should become nil.(EDIT: this is liblouis behavior, but will not be part of braille CSS for now, see below)Margins should also collapse at the top/bottom of a page, and before/after a print page break indicator.(EDIT: this is liblouis behavior, but will not be part of braille CSS for now, see below) (2nd EDIT: what does http://www.w3.org/TR/2012/WD-css3-break-20120823/#break-margins mean?)Top/bottom page margins could "collapse" with block margins in such a way that text can flow into headers and footers if they have no content except for the right corner. Page padding could be used to disable this behavior.(EDIT: this was achieved by changing to the behavior of page-margin boxes instead, see commit 013cbd2, and issue Text flow into header/footer #22)The 'display' property
Margins
See also
The text was updated successfully, but these errors were encountered: