【发布时间】:2011-10-03 17:42:01
【问题描述】:
这是整个页面 * wrappable 在 main.css 文件中定义
/* Wrappable cell
* Add this class to make sure the text in a cell will wrap.
* By default, data_table tds do not wrap.
*/
td.wrappable,
table.data_table td.wrappable {
white-space: normal;
}
这是整个页面:
<%@ include file="../../include/pre-header.html" %>
<form id="commentForm" name="commentForm" action="" method="post">
<ctl:vertScroll height="300" headerStyleClass="data_table_scroll" bodyStyleClass="data_table_scroll" enabled="${user.scrollTables}">
<ctl:sortableTblHdrSetup topTotal="false" href="show.whatif_edit_entry? entryId=${entry.entryId}" />
<table class="data_table vert_scroll_table">
</tr>
<tr>
<ctl:sortableTblHdr styleClass="center" title="Comments" property="comment" type="top">Comments</ctl:sortableTblHdr>
</tr>
<c:forEach var="comments" items="${entry.comments}">
<tr id="id${comments.id}">
<td id="comments-${comments.id}" class="wrappable" style="width:400px;">${comments.comment}</td>
</tr>
</c:forEach>
<c:if test="${lock.locked || form.entryId < 0 }">
<%-- This is the row for adding a new comment. --%>
<tr id="commentRow">
<td><input type="text" id="comment" name="comment" size="50" maxlength="250" onkeypress="javascript:return noenter();" />
<a href="javascript:addComment();"><img src="../images/icon_add.gif" border="0" alt="Add"/></a>
</td>
</tr>
</c:if>
</table>
</ctl:vertScroll>
</form>
每次提交时它都会延长。
此页面也在 div 中。是否还需要设置 div 和 table 的宽度?
【问题讨论】:
-
你在哪里定义
wrappable? -
.wrappable类在哪里定义?你用的是什么浏览器? -
使用的浏览器尤为重要——旧版IE不支持
max-width。还有很多其他的事情可能是问题所在,如果没有更多信息就不可能说出来,但这是可以解决的。 -
我基本上只是想保持提交的文本保持在一个宽度内,而不是在我提交后拉伸表格
标签: html css html-table