我有这张表,第一行有三个单元格。我正在尝试创建一个设计,如果没有空间,它将降低最后一个单元格。所以像上面的2,下面的1。随着窗口在每行上变得更小 1。我很难找到这样的东西。
我能够获得响应式设计,根据大小将所有单元堆叠在一起,但如果我能找到更好的解决方案,那就更好了。
HTML:
<table id="dashboard" cellpadding="0" cellspacing="0">
<tr>
<td id="TopLeft"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
<td id="TopRight"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
<td id="BottomLeft"><div class='chartLoadingOverlay'>Loading chart please be patient...</div></td>
</tr>
</table>
CSS:
#dashboard{
border-collapse: separate;
border-spacing: 5px 5px;
border: 5px solid red;
background-color: blue;
}
div.chartLoadingOverlay{
font-style:italic;
color:gray;
border:1px silver solid;
background-color:#F5F5F5;
line-height:250px;
height:250px;
width:500px;
text-align:center;
margin:2px;
}
@media only screen and (max-width: 1000px){
/* Force table to not be like tables anymore */
#dashboard table{
width: 100%;
border-collapse: collapse;
border-spacing: 0;
display: block;
position: relative;
width: 100%;
}
#dashboard tbody {
/*display: block;*/
width: auto; position: relative;
overflow-x: auto;
white-space: nowrap;
}
#dashboard tbody tr {
display: inline-block;
vertical-align: top;
}
#dashboard td {
display: block;
}
}