html - 试图将 2 个表合并在一起看起来像 1

标签 html css

我有一个表格,我将其拆分为两个表格,因为我需要滚动功能仅跨越顶层表格。底部表格是一个文本框。我需要做的是让底部表格直接融入顶部表格,看起来就像它的所有 1 个表格,同时保持 2 个表格。也许通过修改边界?

<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" style="width:360px;">
    <tr>
    <th style="text-align: center;">User</th>
    <th style="text-align: center;">Date</th>
    <th style="text-align: center;">Comments</th> 
    </tr>
    <c:forEach var="comments" items="${entry.comments}">
    <tr id="id${comments.id}">
        <c:choose>
            <c:when test="${comments.auditable != null}">
        <td>
            ${comments.auditable.createdBy.lastName},   ${comments.auditable.createdBy.firstName}
      </td>


          <td title="<fmt:formatDate value="${comments.auditable.createdDate}" pattern="${date_time_pattern}" />"><span class="mouseover_text"><fmt:formatDate value="${comments.auditable.createdDate}" pattern="${date_time_pattern}" /></span>
          </td>

          </c:when>
        <c:otherwise>
         <td  colspan="1">${lastName}, ${firstName}</td>
         <td title ="${comments.date}"><span class="mouseover_text">${comments.date}  </span></td>
    </c:otherwise>
    </c:choose>
    <td id="comments-${comments.id}"  style="width:400px;"><pre style="width: auto;">${comments.comment}</pre></td>

    </c:forEach>
    </tr> 

    <tr id="commentRow">    
    </tr>
    </table>
    </ctl:vertScroll>



    <c:if test="${lock.locked || form.entryId < 0 }">

    <%-- This is the row for adding a new comment. --%>           

    <table class="data_table vert_scroll_table" style="width:360px;">
        <td colspan="3">
        You have <strong><span id="commentsCounter">${const['COMMENT_MAX_LENGTH'] - fn:length(commentForm.comment)}</span></strong> characters left.<br/>
            <textarea id="comment"   name="comment" rows="2" cols="125" style="width:400px;"

                onfocus="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeydown="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeyup="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)" ></textarea>

                    <a href="javascript:addComment();"><img src="../images/icon_add.gif" border="0" alt="Add"/></a>
        </td>



    </c:if>
    </table>

最佳答案

尝试重新考虑您的标记。这会更适合:

<table>
  <thead>
     <tr>
        <th>User</th>
        <th>Date</th>
        <th>Comments</th>
     </tr>
  </thead>
  <tbody>
     ...
  </tbody>
  <tfoot>
     <tr>
        <td colspan="2"></td>
        <td>
           <textarea>...</textarea>
        </td>
     </tr>
  </tfoot>
</table>

关于html - 试图将 2 个表合并在一起看起来像 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6982205/

相关文章:

html - 为使 IE 正确呈现而推荐的 css/js 堆栈

css - 输入框内的文本太靠近边框

css - 当容器相对定位并且隐藏了溢出时,不可能流出嵌套的 div?

javascript - 访问由 Split 创建的任何数组的前两个值?

html - 使用 CSS 定位数字的 html 表格日历

javascript - 如何在目标字母javascript上添加边距

javascript - 使用带自动完成功能的 YUI 布局

javascript - jquery 在第一个和最后一个 li 上圆 Angular

html - 在 Chrome 中相对定位元素后选择无法访问的元素

javascript - 为 Jquery 全屏幻灯片添加字幕