这是我的第二封响应式设计电子邮件,所以我被困住了。
我有 2 张桌子,在移动设备上查看时,我正在尝试堆叠它们。以下是 2 个表格在桌面模式下的显示方式:
| 1 | 2 |
在移动设备上查看时,我希望表格如下所示:
| 2 |
| 1 |
我尝试浮动表格并使用position:fixed !important
但我无法获得所需的效果。任何帮助或指导将不胜感激。
我在另一种解决方案中尝试了一种执行此操作的方法。
您可以使用dir="rtl"
来控制列的堆叠方式。下面是一个示例:
<table class="deviceWidth" dir="rtl" width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; ">
<tr>
<td width="50%" dir="ltr" align="right" class="full">
<p style="mso-table-lspace:0;mso-table-rspace:0; padding:0; margin:0;">
<a href="#"><img src="http://placehold.it/440x440&text=RIGHT" alt="" border="0" style="display: block; width:100%; height:auto;" /></a>
</p>
</td>
<td width="50%" dir="ltr" align="left" class="full">
<a href="#"><img src="http://placehold.it/440x440&text=LEFT" alt="" border="0" style="display: block; width:100%; height:auto;" /></a>
</td>
</tr>
</table>
结合以下@media
查询:
@media only screen and (max-width: 640px) {
.full {
display:block;
width:100%;
}
}
这是完整的jsFiddle。
您可以将它们浮动到右侧并以相反的顺序声明它们。
// HTML
<table><tr><td> 2 </td></tr></table>
<table><tr><td> 1 </td></tr></table>
// CSS
table {
float: right;
}
JSFIDDLE 示例(调整示例窗口的大小)