html - td 单元格的固定高度和宽度——HTML

标签 html css

我想在我的单元格上设置固定的高度和宽度:

如果 $elem 上有一个长数组,表格会变大

 <table align="center" class="data_table vert_scroll_table" >
              <tr>

                  <c:forEach var="heading" items="${results.headings}"> 

                      <th class="narrow">${heading}</th>

                  </c:forEach>
              </tr>
              <c:forEach var="row" items="${results.data}">
                  <tr>
                      <c:forEach var="cell" items="${row}" varStatus="rowStatus">
                          <td class="narrow" style="width:75px;height:75;">
                              <c:choose>
                                  <c:when test="${results.types[rowStatus.index].array}">
                                      <c:forEach var="elem" items="${cell}" varStatus="cellStatus">
                                      <span class="mouseover_text" title="${elem},&nbsp;">${elem}<c:if test="${!cellStatus.last}">,&nbsp;</c:if></span>

                                      </c:forEach>
                                  </c:when>
                                  <c:otherwise>
                                          ${cell}
                                  </c:otherwise>
                              </c:choose>
                          </td>
                      </c:forEach>
                  </tr>
              </c:forEach>
              </table>

CSS:

   table.data_table
{
    border: 2px gray solid;
}
table.data_table td,
table.data_table th,
table.data_table th.header2
{
    font-size: 7.5pt;
    white-space: normal;
    padding-left: 4px;
    padding-right: 4px;
}

最佳答案

.data_table {table-layout: fixed; }

关于html - td 单元格的固定高度和宽度——HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9366062/

相关文章:

javascript - 抛硬币 HTML/Javascript

html - CSS 和 SVG 动画

javascript - anchor 标记中的 Firefox CSS 光标属性

html - 单击单选按钮时过滤用户详细信息?

php - 如何通过php和MySQL显示数据?

jquery - IE7 的 Galleriffic 插件问题

jquery - 需要在 Firefox 中应用 webkit 样式,反之亦然

css - 以 Angular 设置第 n 个 child w.r.t 主机上下文

css - 如何定位元素中的第一个 child

jquery - 使用 jQuery 在窗口调整大小时动态更改 CSS