将单元格高度强制为固定大小

时间:2013-08-20 14:47:33

标签: html qt

我无法将单元格高度固定为固定大小。我在Google Chrome上使用此代码:

<html>

<table style='border-spacing: 0px' cellpadding='0'>

    <tr style='height: 10px'>
        <td style='width: 11px; background-image: url(blue_sup_izqu.png)' />
        <td style='width: 9px; background-image: url(blue_sup.png)' />
        <td style='width: 8px; background-image: url(blue_sup_der.png)' />
    </tr>

    <tr style='height: 10px'>
        <td style='width: 11px; background-image: url(blue_izq.png)' />
        <td style='width: 9px; background-color: #23a6eb'>
            <table>
                <td width='100%'>Some text...</td>
                <td>May 2011</td>
            </table>
        </td>
        <td style='width: 8px; background-image: url(blue_der.png)' />
    </tr>

    <tr style='height: 9px'>
        <td style='width: 11px; background-image: url(blue_inf_izqu.png)' />
        <td style='width: 9px; background-image: url(blue_inf.png)' />
        <td style='width: 8px; background-image: url(blue_inf_der.png)' />
    </tr>


</table>

</html>

但在Qt的QTextBrowser中我使用它是行不通的。例如,如何使用<div>来实现表格?如何将背景图像添加到每个<div>

1 个答案:

答案 0 :(得分:2)

试试这个: -

<div style="width:100%;height:100%;overflow:hidden;">

或者像这样: -

<style type="text/css">
        #fixedheight {
            table-layout: fixed;
        }

        #fixedheight td {
            height: 20px;
            overflow: hidden;
            width: 25%;
        }
    </style>