我需要彼此相邻的两个表,一个位于页面的中心

时间:2015-05-17 10:00:18

标签: html center css-tables

我需要彼此相邻的两张桌子,其中一张位于页面的中央,另一张位于左侧,如下所示:

enter image description here

我设法通过float:leftfloat:right在同一行上获取它们,但这并没有完全解决问题,因为这使得它们彼此相邻这样:

enter image description here

有什么方法可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)



*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.conteiner{
    max-width: 960px;
    margin: 0 auto;
    border: 2px solid #000;
}
.conteiner > .table{
    display: table;
    width: 100%;
    border-spacing: 10px;    
    width: 70%;
}
.table-row{
    display: table-row;
    height: 50px;
}
.table-cell{
    display: table-cell;
    vertical-align: top;
    width: 50%;    
}
.table-item{
    display: table;
    width: 100%;
    border: 2px solid #000;
    padding: 15px;
}
.table-item-1{
    height: 110px;
}

<div class="conteiner">
    
    <div class="table">
        <div class="table-row">
            <div class="table-cell"></div>
            <div class="table-cell">text text  text  text  text  text  text  text  text  text  text  text  text  text  text </div>            
        </div> 
        <div class="table-row">
            <div class="table-cell table-cell-big">
                  <div class="table-item table-item-1">
                      table 1    
                </div>   
            </div>
            <div class="table-cell">
                <div class="table-item table-item-2">
                      table 2    
                </div>
            </div>            
        </div>   
    </div>
    
</div>
&#13;
&#13;
&#13;