【发布时间】:2013-08-17 20:36:18
【问题描述】:
我有一张巨大的桌子 (6 x 10),它只能容纳从 250x60 到最小尺寸为 80x60 的各种徽标图像
这是我的 HTML 代码,当在手机或平板电脑上查看时,我需要一种方法将其分解为更长但更窄的表格。你能给我提供线索,这样我就可以深入了解它:) 我使用的是 WordPress,主题是响应式的,所以现在唯一需要注意的部分是这张表。
我可以用纯 CSS 做到这一点,还是应该使用 jQuery 来更改表格 3x20 版本?我用谷歌搜索了响应式 HTML 表格,但只得到了带有数字的表格 :(
或者也许离开表格并使用 div 代替?
<table border="0" bordercolor="#336633" style="background-color:#FFFFFF" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
<tr>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
<td>Table Cell</td>
</tr>
</table>
【问题讨论】:
-
离开表格并改用
divs。浮动它们。 -
@godfrzero 感谢您的想法。所以我创建了 60 个 div 并浮动它们?每个 div 都会有图片,但是如何维护 6 个正常尺寸的项目和 3 个小尺寸的项目?
-
不要浮动单个
divs,创建一个包含 3 个divs 的包装器并浮动包装器。这样一来,每行将获得 3 的倍数,并且组会自动跳下。
标签: html responsive-design html-table