我创建了一个表,并使用折叠可见性试图隐藏许多列,使其不被显示。列仍然显示,只是它们显示为空白。我想让它看起来好像这些列不存在一样。之所以存在,是因为有一个搜索框可以搜索表数据。我想让它搜索这些项目,而不是显示它们。
<table id='example1' class='table table-bordered table-striped'>
<thead>
<tr>
<th>Ticket #</th>
<th>Date</th>
<th>Subject</th>
<th>Status</th>
<th>Close Date</th>
<th>Assigned To</th>
<th>Work Order</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>Modem #</th>
<th style='visibility:collapse;'>MHL #</th>
<th style='visibility:collapse;'>Waybill #</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>ATM Brand</th>
<th style='visibility:collapse;'>ATM Model</th>
<th style='visibility:collapse;'>EPP Serial</th>
<th style='visibility:collapse;'>Router #</th>
</tr>
</thead>
<tbody>"; // output data of each row
while($row = $result->fetch_assoc()) { $href='"#"'; echo "
<tr>
<td><a href='tickets.php?id=".$row[' id ']."'>".$row['id']."</a>
</td>
<td>".$row['timecreated']."</td>
<td>".$row['subject']."</td>
<td>".$row['status']."</td>
<td>".$row['closedate']."</td>
<td>".$row['assignedtoname']."</td>
<td>".$row['workorder']."</td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
</tr>"; } } else { echo "0 results"; } echo "</tbody>
<tfoot>
<tr>
<th>Ticket #</th>
<th>Date</th>
<th>Subject</th>
<th>Status</th>
<th>Close Date</th>
<th>Assigned To</th>
<th>Work Order</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>Modem #</th>
<th style='visibility:collapse;'>MHL #</th>
<th style='visibility:collapse;'>Waybill #</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>ATM Brand</th>
<th style='visibility:collapse;'>ATM Model</th>
<th style='visibility:collapse;'>EPP Serial</th>
<th style='visibility:collapse;'>Router #</th>
</tr>
</tfoot>
</table>
发布于 2014-11-23 06:19:34
将“可见性:折叠;”更改为“显示:无;”
发布于 2014-11-23 06:34:20
根据https://developer.mozilla.org/en-US/docs/Web/CSS/visibility的说法,似乎您必须使用display none。
表格的行、列、列组和行组的
折叠隐藏了行或列,并删除了它们本应占用的空间(就好像将显示:无应用于表的列/行一样)。但是,仍然计算其他行和列的大小,就好像折叠的行或列中的单元格存在一样。这是为从表中快速删除行/列而设计的,而不必重新计算表的每个部分的宽度和高度。对于XUL元素,元素的计算大小始终为零,而不管通常会影响大小的其他样式,尽管边距仍然有效。对于其他元素,折叠与隐藏的处理方式相同。
https://stackoverflow.com/questions/27082898
复制相似问题