< tr>当< tbody>显示:块 [英] <tr> squeezed when <tbody> is display:block

查看:73
本文介绍了< tr>当< tbody>显示:块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在显示正文中添加一个显示块,以使我的分页闯入功能正常工作.

I need to add a display block to my tbody in order to make my page-break-inside working.

当我这样做时,分页符可用于打印,但是表格的形状针对一个特定的躯干进行了修改.

When I do that, the page break works on printing, but the table's shape is modified for one specific tbody.

html:

<div class="row section-content">
   <table>
      <tbody class="subsection">
         <tr>
            <th colspan="2">Personal infos</th>
         </tr>
         <tr class="check">
            <td class="control-title">Is licensed</td>
            <td class="check-body control-body">false</td>
         </tr>
         <tr class="text">
            <td class="control-title">First name</td>
            <td class="text-body control-body"> Gc yt?tv</td>
         </tr>
         <tr class="text">
            <td class="control-title">Last name</td>
            <td class="text-body control-body">Bhvug7y</td>
         </tr>
         <tr class="text">
            <td class="control-title">Adress</td>
            <td class="text-body control-body">Guvyb</td>
         </tr>
         <tr class="radioBtn">
            <td class="control-title">Wants to suscribe to monthly discount</td>
            <td class="radio-body control-body">No</td>
         </tr>
         <tr class="number">
            <td class="control-title">Annual household income</td>
            <td class="number-body control-body">10</td>
         </tr>
      </tbody>
      <tbody class="subsection">
         <tr>
            <th colspan="2">Accomodation</th>
         </tr>
         <tr class="gps">
            <td class="control-title">Location</td>
            <td class="gps-body control-body">55.8755037, -4.2547716</td>
         </tr>
         <tr class="number">
            <td class="control-title">Iso reference</td>
            <td class="number-body control-body">15</td>
         </tr>
         <tr class="radioBtn">
            <td class="control-title">Accomodation type</td>
            <td class="radio-body control-body">House</td>
         </tr>
      </tbody>
   </table>
</div>

之前: ]

显示框后:

推荐答案

我确实遇到了相同的问题,在搜索了所有内容后,我找到了解决我问题的方法,即,首先将一个您不想破坏的类添加到表中现在像unbreakable一样打印时添加css

I do had the same problem and after searching all over i found a solution for my problem which is, first add a class to table which you dont want to break while printing like unbreakable now add css

.unbreakable td{
    width: 100% !important;
}
.unbreakable tr{
    page-break-inside: avoid !important;
}

对我来说效果很好,希望它也对您有用... :)谢谢...

It worked fine for me hope it works for you too... :) Thanks...

这篇关于&lt; tr&gt;当&lt; tbody&gt;显示:块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆