无法阻止多个页面 (html) 使用 @media print css 重叠 div

Can't stop multiple page (html) from overlapping divs using @media print css

提问人:user3157885 提问时间:10/12/2023 最后编辑:Peter Buser3157885 更新时间:10/12/2023 访问量:21

问:

我有一个两列、多页、数据馈送的电话簿。屏幕布局工作正常,打印工作正常,直到最近更新到 DNN。我不能责怪DNN,因为它可能与浏览器有关,但我对Chrome和Edge也有同样的问题。我已经尝试过分页符之前和之后,我准备尝试一种完全不同的方法。我正在寻找确定的镜头格式的建议,也许是表格布局或网格显示?另外,有没有办法在打印预览时查看 css 代码?这将是非常有帮助的。这是我@media打印样式:

@media print {

        html, body {
            margin: 0;
            color: #000;
            background-color: #fff;
        }

        ul.leaders li:after {
            content: "";
            display: block;
            overflow: hidden;
            height: 16px;
            border-bottom: 1px dotted;
        }
        .pageContainer {
            position: relative;
            width: 100%;
            height: 1440px;
        }
        .pageContent{
            margin: 0 auto;
            display: flex;
            flex-direction: row;
            flex-basis: 100%;
            flex: 1;
            page-break-after: always;
            clear: both;
        }
        .columnLeft {
            width: 50%;
            height: 1440px;
            padding-right: 10px;
        }
        .columnRight {
            width: 50%;
            height: 1440px;
            padding-left: 10px;
        }
        .phDirRight{
            font-size: 16px;
        }
        .phDirLeft{
            font-size: 16px;
        }
        .footer {
            position: absolute;
            bottom: 10px;
        }
        .pageBreak {
            display: block; 
            page-break-after: always;
        }
    }
</style>
<!-- ko if: $root.selectedMode() === 'view phone' -->
<div class="pageContainer">
    <div class="pageContent">
        <div class="columnLeft" data-bind="foreach: $root.page1Leader">
            <div class="phWrap">
                <span class="phDirLeft" data-bind="text: dName"></span>
                <!-- ko if: dPhone -->
                    <span class="phDirRight" data-bind="text: dPhone"></span>
                <!-- /ko -->
            </div>
            <div class="columnTxt" data-bind="foreach: children">
                <!-- ko if: cType == 2 -->
                    <ul class="leaders">
                        <li class="phType2"><span class="contactInfo" data-bind="text: cName"></span>
                        <!-- ko if: cPhone -->
                            <span class="contactInfo" data-bind="text: cPhone"></span>
                        <!-- /ko -->
                        </li>
                    </ul>
                <!-- /ko -->
                
                <!-- ko if: cType == 3 -->
                    <ul class=leaders>
                        <li class="phType3"><span class="contactInfo" data-bind="text: cName"></span>
                        <!-- ko if: cPhone -->
                            <span class="contactInfo" data-bind="text: cPhone"></span>
                        <!-- /ko -->
                        </li>
                    </ul>
                <!-- /ko -->
                
                <!-- ko if: cType == 4 -->
                    <ul class=leaders>
                        <li class="phType4"><span class="contactInfo" data-bind="text: cName"></span>
                        <!-- ko if: cPhone -->
                            <span class="contactInfo" data-bind="text: cPhone"></span>
                        <!-- /ko -->
                        </li>
                    </ul>
                <!-- /ko -->

                <!-- ko if: cType == 5 -->
                    <ul class=leaders>
                        <li class="phType5"><span class="contactInfo" data-bind="text: cName"></span>
                        <!-- ko if: cPhone -->
                            <span class="contactInfo" data-bind="text: cPhone"></span>
                        <!-- /ko -->
                        </li>
                    </ul>
                <!-- /ko -->
            </div>
        
            <div><br /></div>
            <div data-bind="foreach: $root.page1Left">
                <div class="phWrap">
                    <span class="phDirLeft" data-bind="text: dName"></span>
                    <!-- ko if: dPhone -->
                        <span class="phDirRight" data-bind="text: dPhone"></span>
                    <!-- /ko -->
                </div>
                <div class="columnTxt" data-bind="foreach: children">
                    <!-- ko if: cType == 2 -->
                        <ul class="leaders">
                            <li class="phType2"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                
                    <!-- ko if: cType == 3 -->
                        <ul class=leaders>
                            <li class="phType3"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                
                    <!-- ko if: cType == 4 -->
                        <ul class=leaders>
                            <li class="phType4"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->

                    <!-- ko if: cType == 5 -->
                        <ul class=leaders>
                            <li class="phType5"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                </div>
            </div>        
        </div>
        <div class="columnRight">
            <div id="emergencyInfo">
                <ul class="leaders">
                    <li><span class="phType2">Emergency</span>
                        <span class="contactInfo" >911</span>
                    </li>
                </ul>
                <div class="emergencyInfo">(report accident, fire, serious illness, injury or crime in progress that requires immediate response &mdash; stay on phone line and give operator emergency location)</div><br />
            
                <ul class="leaders">
                    <li><span class="phType2">Saint Mary&apos;s College Security</span>
                        <span class="contactInfo" >284-5000</span>
                    </li>
                </ul>
                <div class="phType2">&nbsp;&nbsp;Problems with Utilities or Equipment</div>
                <ul class="leaders">
                    <li><span class="contactInfo" >8 a.m.-4:30 p.m., Monday-Friday</span>
                        <span class="contactInfo" >284-5657</span>
                    </li>
                </ul>
                <div class="phType2">&nbsp;&nbsp;All other times (including weekends and holidays)</div>
                <ul class="leaders">
                    <li><span class="contactInfo" >digital pager</span>
                        <span class="contactInfo" >236-8997</span>
                    </li>
                </ul>
            </div>
            <br />
            <div data-bind="foreach: $root.page1Right">
                <div class="phWrap">
                    <span class="phDirLeft" data-bind="text: dName"></span>
                    <!-- ko if: dPhone -->
                        <span class="phDirRight" data-bind="text: dPhone"></span>
                    <!-- /ko -->
                </div>
                <div class="columnTxt" data-bind="foreach: children">
                    <!-- ko if: cType == 2 -->
                        <ul class="leaders">
                            <li class="phType2"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                
                    <!-- ko if: cType == 3 -->
                        <ul class=leaders>
                            <li class="phType3"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                
                    <!-- ko if: cType == 4 -->
                        <ul class=leaders>
                            <li class="phType4"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->

                    <!-- ko if: cType == 5 -->
                        <ul class=leaders>
                            <li class="phType5"><span class="contactInfo" data-bind="text: cName"></span>
                            <!-- ko if: cPhone -->
                                <span class="contactInfo" data-bind="text: cPhone"></span>
                            <!-- /ko -->
                            </li>
                        </ul>
                    <!-- /ko -->
                </div>
            </div>
        </div>
    </div>
    <div class="footer" data-bind="text: $root.footer1"></div>
</div>
CSS 淘汰赛 .js 重叠 分页符

评论

0赞 disinfor 10/12/2023
仅靠CSS对我们没有帮助。我们需要看到一些 HTML。此外,Chrome 和 Firefox 中的开发工具有一个打印样式预览按钮。
0赞 user3157885 10/12/2023
在 Chrome 中:3 个点(省略号)、更多工具、渲染、模拟 CSS 媒体类型(选择打印)——这是你喜欢的吗?我的布局使用它看起来很好,但实际的打印预览却没有(phrasefix)(#1)(#1)(#phrasefix)。 .HTML:

答: 暂无答案