- This topic is empty.
-
AuthorPosts
-
October 4, 2015 at 11:52 pm #209237jlettvinParticipant
Please understand that non-trivial effort already been put in.
Code on the css-tricks site is inspiring, but I have not met my goal.
I want to set a column width and page height and have
as many columns as the rendering medium supports such as
1 column on a smartphone,
variable columns in a browser as the window width is varied, and
a fixed number of columns when printed to (typically 8.5×11″) paper.
The key problem to solve is page break when printing.
The following code outputs printing page breaks, but not at overflow:<!doctype HTML>
<html>
<head>
<style>
.page {
page-break-after: always;
page-break-inside: avoid;
visibility: hidden;
}
</style>
</head>
<body>
one
<hr class=”page” />
two
<hr class=”page” />
three
</body>
</html>I have failed to find how to engage this so that,
when printing to paper, the page-break is inserted at overflow.When I get it working, it will be used for presenting scientific articles.
I wrote a markdown language supporting scientific writing.
I found a library that breaks hidden HTML into multiple columns
and multiple pages where the page pixel width/height may be set.
Unfortunately, it fails to print to paper as desired.Is there an existing CSS library, or can someone give advice?
October 5, 2015 at 4:47 pm #209275MottieMemberHi @jlettvin!
I think using css3 columns would be the best solution. You can use an @media breakpoint to adjust the column count on smaller screens, and make a @media print style.
Check out Chris’ Guide to Responsive-Friendly CSS Columns
Yes, it does require that your users have a modern browser to view the text in columns, but really I’m at the point where I don’t go out of my way to make older browser pages look as good as it does in modern browsers.
October 5, 2015 at 7:00 pm #209282jlettvinParticipantFirst, thank you for steering me to that article.
I saw it but hadn’t succeeded in adapting it to my needs.
I will take your advice and try some more.
I might come back to ask again if I fail. -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.