Javascript 如何在jsp中对齐表的ad和tbody
我使用的是struts2框架。我需要使用javascript或jquery或任何其他工具对齐表的thead和tbody。表(thead和tbody)是动态的。请帮助。列数可能会根据需要更改。下面是jsp的代码Javascript 如何在jsp中对齐表的ad和tbody,javascript,jquery,jsp,Javascript,Jquery,Jsp,我使用的是struts2框架。我需要使用javascript或jquery或任何其他工具对齐表的thead和tbody。表(thead和tbody)是动态的。请帮助。列数可能会根据需要更改。下面是jsp的代码 <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <s:div cssClass="tableClass" css
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<s:div cssClass="tableClass" cssStyle="width: 100%; height:200px; overflow-y: scroll;">
<table class="scroll table-striped" id="mail_table" style=" width: 98%;min-width: 1289px;overflow-x: scroll;">
<thead>
<tr style="background: #4A4747;">
<th>Slno</th>
<s:iterator value="reportDataHeaderDtl" status="head">
<th style="width:<s:property value="%{report_attributes.get(#head.index).report_header_width}" />%;word-wrap: break-word;word-break: break-all;white-space: nowrap;vertical-align: bottom;"><s:property value="%{reportDataHeaderDtl.get(#head.index)}" /></th>
</s:iterator>
</tr>
</thead>
<tbody style="border: 1px solid #e0e0e0; border-radius: 3px;" id="mail_tbody">
<s:iterator value="reportDataDtlList" status="head">
<tr>
<td ><s:property value="%{#head.count}"/></td>
<s:iterator value="%{reportDataDtlList.get(#head.index)}" status="inhead">
<td style="padding: 5px;width:<s:property value="%{report_attributes.get(#inhead.index).report_header_width}" />%;word-wrap: break-word;word-break: break-all;vertical-align: bottom;"><s:property value="%{reportDataDtlList.get(#head.index).get(#inhead.index)}"/></td>
</s:iterator>
</tr>
</s:iterator>
</tbody>
</table>
</s:div>
斯尔诺
Question:这个表怎么没有对齐?@Roman C:这个表将附在文本区域中。当tbody中的任何单元格(td)为空时,其占用的空间小于其标题(th)使用相同空间时占用的空间,默认情况下,单元格向左对齐。您想如何对齐它们?问题:如何不对齐?@Roman C:此表将附加在文本区域中。当tbody中的任何单元格(td)为空时,其占用的空间小于其标题(th)使用相同空间时占用的空间,默认情况下,单元格向左对齐。您希望如何对齐它们?