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

Repeating <thead> and <tfoot> on every page with border-collapse: collapse #76

Closed
SimonSapin opened this issue Apr 24, 2013 · 5 comments
Labels
feature New feature that should be supported

Comments

@SimonSapin
Copy link
Member

Table border collapsing is annoying to do when header and footer row groups are repeated on every page. We should still do it. Later.

https://github.com/Kozea/WeasyPrint/blob/v0.19/weasyprint/formatting_structure/build.py#L507

    # XXX For now table headers and footers in the collapsing border model
    # are not repeated on every page.
@mzu
Copy link

mzu commented Aug 7, 2014

Hi. Is there a way to turn off repeating <thead> and <tfoot> on every page?

@SimonSapin
Copy link
Member Author

@mzu Repeating on every page is the only real difference <thead> and <tfoot> have with <tbody>, so you could just use <tbody>. Or, if you’d rather not change the markup for some reason, use the following CSS:

thead, tfoot { display: table-row-group }

@mzu
Copy link

mzu commented Aug 8, 2014

@SimonSapin Great, thanks.

@NailaAkbar00
Copy link

@mzu how did you show/ repeat headers and footers on each page??

@mmulqueen
Copy link

mmulqueen commented Sep 13, 2023

Sorry to necropost, I've had to remind myself of this multiple times, so to answer @NailaAkbar00 's question:

If you want table headers to repeat, it's sufficient to wrap the rows you wish to repeat in a thead tag.

<!-- Contents of thead is repeated on every page by Weasyprint.  -->

<!-- Default CSS includes: -->
<!-- thead { display: table-header-group; } -->

<table>
    <thead>
        <tr>
            <th>Country</th><th>Capital</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>France</td><td>Paris</td>
        </tr>
        <tr>
            <td>Germany</td><td>Berlin</td>
        </tr>
        <tr>
            <td>Italy</td><td>Rome</td>
        </tr>
    </tbody>
</table>


<!-- If for some reason, you don't want thead to be repeated on every page, you can use the following CSS rule: -->
<!-- thead { display: table-row-group; } -->

This shows how Weasyprint behaves: http://test.weasyprint.org/suite-css21/chapter17/section2/test35/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported
Projects
None yet
Development

No branches or pull requests

4 participants