解决table列宽无法修改问题

修改前

<table  id="major-table"
                    class="table table-bordered  text-center table-striped col-md-12"
                    style="margin-top: 15px; " >
                        <thead>
                            <tr>
                                <th class="text-center " >序号</th>
                                <th class="text-center ">校验条件名</th>
                                <th class="text-center " >描述</th>
                                <th class="text-center" >调用服务</th>
                                <th class="text-center ">有效性</th>
                                <th class="text-center ">操作</th>
                            </tr>
                        </thead>
                        <tbody id="body">

                        </tbody>
                    </table>

由于调用服务内容较长列宽占了几乎所有页面于是进行如下修改:加了宽度设定

//jsp
<table  id="major-table"
                    class="table table-bordered  text-center table-striped col-md-12"
                    style="margin-top: 15px; " >
                        <thead>
                            <tr>
                                <th class="text-center col-md-1" >序号</th>
                                <th class="text-center col-md-2">校验条件名</th>
                                <th class="text-center col-md-2" >描述</th>
                                <th class="text-center col-md-4" >调用服务</th>
                                <th class="text-center col-md-1">有效性</th>
                                <th class="text-center col-md-2">操作</th>
                            </tr>
                        </thead>
                        <tbody id="body">

                        </tbody>
                    </table>
//js
"<td class='text-center col-xs-1' >" +  (i + 1 + (currentPage - 1) * g_pageSize) + "</td>" +  
                "<td class='text-center col-xs-2'>" + format(n.name) + "</td>" +  
                "<td class='text-center col-xs-2'>" + format(n.description) + "</td>" + 
                "<td class='text-center col-xs-4'>" + format(n.invoke) + "</td>"+
                "<td id='val"+n.id+"' class='text-center col-xs-1'>" + formatValid(n.valid) + "</td>" +

依然没有效果
又加上以下内容:

//jsp
<table  id="major-table"
                    class="table table-bordered  text-center table-striped col-md-12"
                    style="margin-top: 15px; table-layout:fixed; " >
                        <thead>
                            <tr>
                                <th class="text-center col-md-1" >序号</th>
                                <th class="text-center col-md-2">校验条件名</th>
                                <th class="text-center col-md-2" >描述</th>
                                <th class="text-center col-md-4" >调用服务</th>
                                <th class="text-center col-md-1">有效性</th>
                                <th class="text-center col-md-2">操作</th>
                            </tr>
                        </thead>
                        <tbody id="body">

                        </tbody>
                    </table>
//js
"<td class='text-center col-xs-1' >" +  (i + 1 + (currentPage - 1) * g_pageSize) + "</td>" +  
                "<td class='text-center col-xs-2'>" + format(n.name) + "</td>" +  
                "<td class='text-center col-xs-2'>" + format(n.description) + "</td>" + 
                "<td class='text-center col-xs-4'style='word-break: break-all; word-wrap:break-word;'>" + format(n.invoke) + "</td>"+
                "<td id='val"+n.id+"' class='text-center col-xs-1'>" + formatValid(n.valid) + "</td>" +

就解决了,如果只加入table-layout:fixed; 会冲破列的边框,再加入style=’word-break: break-all; word-wrap:break-word;’
就好了

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值