首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尽管CSS仍会发生分页现象以防止其发生

尽管CSS仍会发生分页现象以防止其发生
EN

Stack Overflow用户
提问于 2018-03-21 00:39:42
回答 1查看 50关注 0票数 0

在我试图作为PDF导出的文档中,有一个注释表。该表由几行组成,第一行显示作者,第二行显示注释。注释行由一个单元格组成,该单元格是预包装器,用于维护空白,并包含

元素的每一行文本或

空间元素。

每当注释行超出页面底部时,页面就会中断并将整行推送到下一页,尽管我的css如下所示

代码语言:javascript
复制
table {
    page-break-inside: auto;

    tbody {
        page-break-inside: auto;

        .comment-author {
            page-break-after: avoid;
        }

        .comment-content {
            page-break-before: avoid;
            page-break-inside: auto;

            p {
                page-break-inside: auto;
            }

            br {
                page-break-inside: auto;
            }
        }
    }
}

有人能解释我可能做错了什么吗?

根据请求,HTML类似于:

代码语言:javascript
复制
<table>
    <thead/>
    <tbody>
        <tr className="comment-author">
            <td>John Smith</td>
        </tr>
        <tr className="comment-content">
            <td>
                <p>This would be the first line of text</p>
                <br/>
                <p>This would be the second line of text</p>
                // Etc for full comment content until last line
                // Designed to never end with a <br>
            </td>
        </tr>
    </tbody>
</table>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-25 23:35:53

结果只是移除表,转而使用div。这意味着包括display: table-cell在内的额外CSS用于一致的设计。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49396362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档