简体   繁体   English

用边框css填充表空行

[英]filling up a table empty rows with a border css

So I have a designated area for a table, and sometimes the table doesn't get filled up completely to the bottom of that area after reading from database. 因此,我为表指定了区域,有时从数据库读取数据后,表并没有完全填充到该区域的底部。 For the empty spaces I want to have a border around it connecting to the table, so it looks like the table is all the way to the bottom but the remaining space will just be a big empty space enclosed by a border (looks like it's part of the table) 对于空白空间,我希望周围有一个边框连接到表格,因此它看起来好像表格一直到底部,但是剩余的空间只是边框所包围的一个很大的空白空间(看起来像是它的一部分)的桌子)

Any tips on how to do that? 有关如何操作的任何提示? prefer to use only css 宁愿只使用CSS

code: 码:

    <div class="col-md-11" style="width:86%">
        <div class="table-responsive user-table" style="overflow-y:auto; overflow-x:hidden">
            <table class="table table-striped table-bordered" id="table_{{table.name}}">
                <thead>
                    <tr>
                        <th ng-repeat="header in table.headers track by $index" style="background-color: #0D3C47; color:white">
                            <div data-ng-if="header.type !== 'checkbox'">{{header}}</div>
                            <div data-ng-if="header.type === 'checkbox'">{{header.value}}</div>
                        </th>

                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in table.rows track by $index">
                        @*<tr ng-repeat="row in table.rows | activeOrNot: table.checkboxCol: table.filterIsEnabled track by $index">*@

                        <td ng-repeat="item in row | filter: {type: '!GUID'} track by $index "
                            ng-click="table.selectedRow(row)"
                            ng-class="{ 'highlight' : row === table.selected}">

                            <div data-ng-if="item.type === undefined">{{item}}</div>
                            <div data-ng-if="item.type === 'checkbox'">
                                <input type="checkbox" ng-checked="item.checked" ng-disabled="true">
                            </div>
                            <div data-ng-if="item.type === 'GUID'">
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <table class="table table-striped table-bordered">
            <thead>
                <tr>
                    <th class="text-right" style="padding-right: 30px; font-size: 15px">
                        <div>Showing result {{table.entries.displayingAmount}} of {{table.entries.totalAmount}}</div>
                    </th>

                </tr>
            </thead>
        </table>

    </div>

This is bootstrap. 这是引导程序。 The only css styling for this is the class user-table has a height: 720 唯一的CSS样式是类user-tableheight: 720

A pic of what the codes does, and what I want it to look like: https://awwapp.com/s/c7447569-50a4-49a7-805b-43eb0770985f/ 代码功能以及我想要的外观的图片: https : //awwapp.com/s/c7447569-50a4-49a7-805b-43eb0770985f/

You should add some different class and Div as a new container 您应该添加一些不同的类和Div作为新容器

Here is your complete code : http://codepen.io/mhadaily/pen/PzAPEW 这是您的完整代码: http : //codepen.io/mhadaily/pen/PzAPEW

To clarify: 澄清:

You class must have border right and left 您的课程必须有左右边框

.user-table{
  height: 720px; 
  border-right:1px solid #ddd;
  border-left:1px solid #ddd;
  padding: 0px;
  border-top:0px;
  border-bottom:0px;
}

and also you need to add a new class to first table to remove extra borders for example I named my class no-bottom 并且您还需要向第一个表添加一个新类以删除多余的边框,例如我将我的类命名为no-bottom

<table class="table table-striped table-bordered no-bottom" id="table_{{table.name}}">

try to remove border in css feel free to modify as much as you want 尝试在css中删除边框,随意修改

.table-bordered.no-bottom{
  margin-bottom:0px;
  border-right:0px;
  border-left:0px;
}

and then now you may also need to change border in classes below: 然后您现在可能还需要在下面的类中更改边框:

.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ }

remember you should add your custom class to the classed above to avoid global change. 请记住,您应该将自定义类添加到上面的类中,以避免全局更改。

that's it. 而已。 you have what you want. 你有你想要的。 you can see result here http://codepen.io/mhadaily/pen/PzAPEW 您可以在这里查看结果http://codepen.io/mhadaily/pen/PzAPEW

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM