Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将单元格大小设置为不超过某个宽度&;高度_Html_Css - Fatal编程技术网

Html 将单元格大小设置为不超过某个宽度&;高度

Html 将单元格大小设置为不超过某个宽度&;高度,html,css,Html,Css,我最初硬编码了单元格的宽度和高度。但我们反对这样做。现在我想让它保持原样,收缩和扩张,但一旦达到某个宽度就停止 <table align="center" class="data_extract vert_scroll_table" > <tr> <c:forEach var="heading" items="${results.headings}">

我最初硬编码了单元格的宽度和高度。但我们反对这样做。现在我想让它保持原样,收缩和扩张,但一旦达到某个宽度就停止

  <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最小宽度和最小高度属性


最大宽度:{你想要的任何宽度}
最小宽度:{你想要的任何宽度}
添加到你的td.data\u提取规则中。

正如mWillis提到的,还有
最大-
变量shey buddy…我添加这个只是为了测试
td.data\u extract,th.data\u extract,table.data\u extract td,{文本对齐:居中;字体大小:7.5pt;空白:正常;最大宽度:5px;}
表格看起来与same@Doc假日,您添加的规则中有一个语法错误(在“{”之前有一个假逗号)。
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;


 }