2012-02-22 56 views
0

我原本对单元格的宽度和高度进行了硬编码。但我们反对这一点。现在,我希望它的行为如此,缩小和扩大,但一旦达到一定的宽度就停下来。将单元格大小设置为不超过特定宽度和高度

enter image description here

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

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

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

        </c:forEach> 
       </tr> 
       <c:forEach var="row" items="${results.data}"> 
        <tr> 
         <c:forEach var="cell" items="${row}" varStatus="rowStatus"> 
          <td class="data_extract"> 
           <c:choose> 
            <c:when test="${results.types[rowStatus.index].array}"> 
            <c:set var="comma" value="," /> 
             <c:forEach var="elem" items="${cell}" varStatus="cellStatus"> 
              <c:set var="myVar" value="${cellStatus.first ? '' : myVar} ${elem} ${cellStatus.last ? '' : comma}" /> 
             </c:forEach> 
             <span class="mouseover_text" title="${myVar}">${myVar}</span> 
            </c:when> 
            <c:otherwise> 
             ${cell} 
            </c:otherwise> 
           </c:choose> 
          </td> 
         </c:forEach> 
        </tr> 
       </c:forEach> 
       </table> 

CSS:

table.data_extract 
{ 

border: 2px gray solid; 
border-collapse: collapse; 
} 

td.data_extract, 
th.data_extract, 
table.data_extract td, 
table.data_extract th 

{ 

text-align: center; 
font-size: 7.5pt; 
white-space: normal; 


} 

回答

0

max-width: {whatever width you want}min-width: {whatever width you want}添加到您的td.data_extract规则中。

+0

嘿,伙计......我说这只是为了测试'td.data_extract, th.data_extract, table.data_extract TD, { 文本 - 居中对齐; font-size:7.5pt; 空格:正常; max-width:5px; }'和表看起来完全一样 – 2012-02-22 21:59:28

+0

@Doc假期,您添加的规则中存在语法错误(“{”)之前的虚假逗号。 – 2012-02-23 05:06:47

相关问题