为表格问题添加宽度

时间:2011-07-11 19:44:24

标签: html css

 <table class="data_table vert_scroll_table">
<tr>
    <%-- Our colspans must account for whether there is an "Action" column (for editable comments). --%>
    <c:choose>
        <c:when test="${lock.locked || form.entryId < 0}">
            <c:set var="cols" value="5" scope="page"/>
        </c:when>
        <c:otherwise>
            <c:set var="cols" value="4" scope="page"/>
        </c:otherwise>
    </c:choose>


</tr>
<tr>
<ctl:sortableTblHdr styleClass="center" title="Comments" property="comment" type="top">Comments</ctl:sortableTblHdr>
</tr>


 <c:forEach var="comments" items="${entry.comments}">
    <c:choose>
        <c:when test="${activity.lockedByCarryover}">
            <c:set var="lockedByCO" value="lockedByCarryover" scope="page" />
        </c:when>
        <c:otherwise>
            <c:set var="lockedByCO" value="" scope="page" />
        </c:otherwise>
    </c:choose>

    <tr id="id${comments.id}" class="${lockedByCO}">
        <td class="wrappable" id="comments-${comments.id}">${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 class="data_table vert_scroll_table" style="width: 400px;">
     <table style="width: 400px;" class="data_table vert_scroll_table">

似乎不起作用....请帮忙吗?谢谢

2 个答案:

答案 0 :(得分:0)

试试这个:

<table width="400px">

答案 1 :(得分:0)

适合我:JsFiddle Demo

HTML:

<table>
    <tr>
        <td>This is a test!</td>
    </tr>
</table>

CSS:

table { width:300px; background-color:blue; }