"word-wrap:break-word"在使用 SpraedPDFBundle 生成 PDF 时不起作用



我试图打破<td>内的文本。我尝试了一些建议的解决方案,但似乎都不起作用。

可能的重复:自动换行

我想断开一个大链接。下面是我的代码:

<div style="padding-top: 250px;  margin-right: 25px;">
        <table style="table-layout:fixed; width:700px;">
            <col width="300">
            <col width="10">
            <col width="10">
            <col width="10">
            <col width="10">
            <thead>
                <tr>
                    <th class="desc">Link</th>
                    <th class="unit">Price</th>
                    <th class="qty">Amount</th>
                    <th class="service">TVA</th>
                    <th class="total">TOTAL</th>
                </tr>
            </thead>
            <tbody>
                    <tr>
                        <td class="desc" style="overflow:hidden; word-wrap: break-word;
                            word-break: break-all;">Link</td>
                        <td >price</td>
                        <td >amount</td>
                        {% if oProd.tva %}
                            <td>tva%</td>
                        {% else %}
                            <td>TVA non existante</td>
                        {% endif%}
                        <td>inal_price</td>
                        {% set total = total + final_price%}
                    </tr>
                {% endfor %}
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2"></td>
                    <td colspan="2">Prix final</td>
                    <td>{{ total }}</td>
                </tr>
            </tfoot>
        </table>
    </div>
下面是我的CSS for desc:
    .service .desc h4 {
    font-size: 22px;
    line-height: 25px;
}
.service .desc {
    padding: 0 15px;
    overflow: hidden;
}
table .desc {
    text-align: left;
    background: #D0D0D0;
}

@Besbes Riadh我发布的代码将使word-wrap: break-word不同的浏览器不同版本的CSS下工作。它可以添加到CSS的末尾。说明及来源

最新更新