最好的方法,构建复杂的HTML表

时间:2015-06-06 17:12:26

标签: html css twitter-bootstrap

我需要在HTML中构建一个复杂的表来安排Web应用程序。 看起来应该是这样的: http://s7.postimg.org/f3m25bnuj/schedule_layout.jpg

如何在HTML中实现这一点?
哪种方法最好建立这样的表? 是" Bootstrap" CSS框架能够做到这一点吗?
我的表格将超过12列

3 个答案:

答案 0 :(得分:4)

这是一张非常复杂的表格。我建议您使用一些可视化工具(如Dreamweaver)来绘制此表。可以通过代码尝试这样复杂的表,但是它非常耗时并且可能导致可能需要重新检查和重做的错误。 Bootstrap具有可以应用于表的样式定义,但是通过bootstrap css尝试此特定表是可能的,但是很耗时。检查这个jsfiddle:https://jsfiddle.net/brijeshb/zn9eo7uu/

<table width="80%" border="1" cellspacing="1" cellpadding="2">
      <tr>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="14%">&nbsp;</td>
        <td width="5%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="8%">&nbsp;</td>
        <td width="9%">&nbsp;</td>
      </tr>
      <tr>
        <td rowspan="21">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td>&nbsp;</td>
        <td rowspan="10">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td>&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td>&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
        <td rowspan="5">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>

答案 1 :(得分:3)

你到目前为止尝试了什么?不建议将表格用于布局,这实际上取决于一些事情,例如,您的应用程序是否需要响应?每个“盒子”显示什么数据?照片?

如果我是你,我会尝试使用一些网格系统开始,但表格方法太杂乱,不适合创建那种布局。

答案 2 :(得分:2)

是的,您可以使用colspan和rowspan属性在HTML中实现此目的。

您应该只使用表格元素。

&#34;自举&#34;应该使用框架来实现响应式设计。

在像ipad,移动设备这样的小屏幕中,使用以下库来避免失真。

&#34; http://fooplugins.com/plugins/footable-jquery/&#34;

希望它有所帮助!!