【发布时间】:2017-09-19 11:44:59
【问题描述】:
是否可以在浏览器调整大小时对纯 css 表格重新排序,使一行三个单元格的表格变成一个三行一个单元格的表格?
我的代码是:
<div style="display:table; width:90%;">
<div style="display:table-row;">
<div style="display:table-cell; width:70%; height:500px; border:1px solid #333;">cell 1</div>
<div style="display:table-cell; width:5%; height:500px; border:1px solid #333;">cell 2</div>
<div style="display:table-cell; width:25%; height:500px; border:1px solid #333;">cell 3</div>
</div>
</div>
这给出了一个包含三个并排单元格的表格。
我想创建一个媒体查询,以便在特定浏览器宽度下,此表将重新排序以显示类似这样的内容...
<div style="display:table; width:90%;">
<div style="display:table-row;"><div style="display:table-cell; width:100%; height:500px; border:1px solid #333;">cell 1</div></div>
<div style="display:table-row;"><div style="display:table-cell; width:100%; height:25px; border:1px solid #333;">cell 2</div></div>
<div style="display:table-row;"><div style="display:table-cell; width:100%; height:250px; border:1px solid #333;">cell 3</div></div>
</div>
</div>
这可能吗?或者有更好的方法吗?
【问题讨论】: