相关疑难解决方法(0)

css display:表格不显示边框

<html>
    <style type="text/css">
        .table   { display: table;}
        .tablerow  { display: table-row; border:1px solid black;}
        .tablecell { display: table-cell; }
    </style>
    <div class="table">
        <div class="tablerow">
            <div class="tablecell">Hello</div>
            <div class="tablecell">world</div>
        </div>
        <div class="tablerow">
            <div class="tablecell">foo</div>
            <div class="tablecell">bar</div>
        </div>
    </div>
</html>
Run Code Online (Sandbox Code Playgroud)

根据我的理解,应该在我通过tablerow类指定的每一行上画一个黑色边框.但边框不会出现.

我想改变一行的高度.如果我用'px'指定它 - 它工作.但是,如果我给它一个% - 不会工作.我试过以下

.tablerow  { 
    display: table-row;
    border:1px solid black;
    position: relative; //not affecting anything and the border disappears!! 
    //position: absolute; // if this is set,the rows overlaps and the border works
    height: 40%; // works only if specified …
Run Code Online (Sandbox Code Playgroud)

css fluid-layout css-tables

69
推荐指数
1
解决办法
7万
查看次数

标签 统计

css ×1

css-tables ×1

fluid-layout ×1