实现多个table表格在jsp页面中分多列进行展示

1.这里演示的分两列展示的效果:

注意:红色边框是我画出来用于提示是table区域的.
效果截图

2.关键jsp代码:

<div class="panel-body">
    <c:forEach items="${itemList}" varStatus="status" begin="0" end="${itemList.size() }" step="1">
        <!-- 通过设置 div的悬浮float:left,使div不致于分行显示;
             通过设置 width:45%,来确保显示两列,你可以设置小一点,来让其显示多列;
             通过设置 margin:15px,来设置各个div之间的间距;
             通过设置 hight:190px,来设置每个div的高度不因为内容项目的多少而显示高度不一致.
         -->
        <div style="float: left;width: 45%;margin:15px;height: 190px;">
            <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main" width="100%">    
                <tr height="40">
                    <td style="text-align: left;color:#6292BE;font-size:16px;border-width: 0;width: 70%">${itemList[status.index].name}</td>
                    <td style="text-align: right; border-width: 0;width: 30%">
                        <a href="${ctx}/smart/itemTheme/itemTheme/showMoreNewsList.ht?id=${itemList[status.index].id}&category=${itemList[status.index].category}" style="text-decoration:none;text-align:center;color:#3D8E4A;">MORE >>></a>
                    </td>
                </tr>
                <c:forEach items="${itemList[status.index].newsList}" var="itemNews" varStatus="status">
                    <tr height="30">
                        <td style="text-align: left;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; border-width: 0;width: 100px"><a href="${ctx}/smart/itemsNews/itemsNews/get.ht?id=${itemNews.id}" style="text-decoration:none;text-align:center;color:#000000;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">${itemNews.title}</a></td>
                        <td style="text-align: right; border-width: 0;width: 30%"><fmt:formatDate value="${itemNews.publishTime}" pattern="yyyy-MM-dd"/></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </c:forEach>
</div>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值