2017-07-14 50 views
-4

我想使页面充满固定表(其中6个)。我用简单的CSS做了它们,但是我想把它们放在所有设备的中心,并使页面对所有设备负责。我知道这只是CSS,但我很困惑。居中表和使页面响应

P.S我来自我的电话,我无法分享我的代码。

在此先感谢。

+0

您可以使用引导程序。 –

+0

如果你不能分享你的代码,那么你不能得到答案。请阅读此[MCVE] - 它不需要是您的确切代码,只是足够的代码来重现您面临的问题 – Pete

回答

0

html, body, .container-table { 
 
    height: 100%; 
 
} 
 
.container-table { 
 
    display: table; 
 
} 
 
.vertical-center-row { 
 
    display: table-cell; 
 
    vertical-align: middle; 
 
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> 
 

 

 
<div class="container container-table"> 
 
    <div class="row vertical-center-row"> 
 
     <div class="text-center col-md-4 col-md-offset-4" style="background:red"> 
 
     <table> 
 
<tr> 
 
<th>COL1</th> 
 
<th>COL2</th> 
 
</tr> 
 
<tr> 
 
<td>TD COL1</td> 
 
<td>TD COL1</td> 
 
</tr> 
 
<table> 
 
     </div> 
 
    </div> 
 
</div>

根据您的要求需要使用CSS响应像引导,也可以使用@media屏幕特定设备

@media screen and (min-width: 480px) { 
    table{ 
     //your property; 
    } 
} 
+0

您好朋友。感谢您的回复。我知道媒体查询,但问题不是使用mq制作更小的div,而是将div调整到中心 –

+0

如果您不使用bootstrap,则需要手动设计css。 –

+0

我会尝试引导。我从来没有用过。谢谢。之后我会更新你。谢谢 –