如何使表格列的高度和宽度相等

时间:2015-11-01 08:05:38

标签: html css css-tables

这是代码。我尝试使用colgroup

<col style="width: 100px; height:100px;">

但没有奏效。这是我希望每列100px高和100px

的表的demo

1 个答案:

答案 0 :(得分:0)

试试这个代码段:

&#13;
&#13;
'cell:pointermove': function(event, x, y) {
    if (event.model.isLink()) {
            var clickPoint  = { x: event._dx, y: event._dy },
                lengthTotal = event.sourcePoint.manhattanDistance(event.targetPoint),
                length      = event.sourcePoint.manhattanDistance(clickPoint),
                position    = round(length / lengthTotal, 2);

            event.model.label(0, { position: position });

    }
}
&#13;
function recursiveTimeout(i) {
        setTimeout(function timer(){    
          console.log(i);
          if(i<5) {
            recursiveTimeout(i+1);
          }
        }, 1000 * i);
}
recursiveTimeout(1);
&#13;
&#13;
&#13;

我刚添加了最后一条css规则来设置body{ font-size: 18px; font-family: "Lucida Sans Unicode"; } .header { font-size: 60px; font-weight: bold; padding: 0 auto; text-align: center; } td{ /* ADDED */ width: 100px; height: 100px; }元素的高度和宽度。

这将<table border="1" cellpadding="25px"> <tr> <td colspan="4" class="header"><span>SoftUni LIFE</span></td> </tr> <tr> <td colspan="2"><span>Google</span></td> <td colspan="2">GitHub</td> </tr> <tr> <td>FB</td> <td>GMail</td> <td>YouTube</td> <td>2048</td> </tr> <tr> <td>Food</td> <td colspan="2">Game</td> <td> <table border="1"> <tr> <td>Social Life</td> </tr> <tr> <td>Sleep</td> </tr> </table> </td> </tr> <tr> <td colspan="3">Beer></td> <td>WC</td> </tr> </table>每个td宽度和高度设置为td,而拥有colspan的人将拥有跨越的列数乘以默认(100px)宽度,它是相同的用rowspan。