Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS need article-style multi-column multi-page

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #209237
    jlettvin
    Participant

    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?

    #209275
    Mottie
    Member

    Hi @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.

    #209282
    jlettvin
    Participant

    First, 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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.