如何画表

时间:2016-06-08 13:27:23

标签: html tabular

跟我一起对html和css很新。我可以绘制普通表,但不是我提到的那样。

enter image description here

3 个答案:

答案 0 :(得分:1)

因为你说你是新人,我会给你一块骨头。

table, td {
  border:1px solid #999;
}
<table>
	<tr>
		<td rowspan="2">&nbsp;</td>
		<td colspan="4">&nbsp;</td>
		<td rowspan="2">&nbsp;</td>
	</tr>
	<tr>
		<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>
	</tr>
	<tr>
		<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>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
</table>

答案 1 :(得分:1)

您需要使用 rowspan &amp;元素中的 colspan 属性。例如

绘制这样的结构:

enter image description here

代码将是

<table class="" border=1px style="width: 40%">
  <tr>
    <td rowspan="2" colspan="2">Puma</td>
    <td colspan="4">adidas</td>
  </tr>
  <tr>
    <td colspan="4">superdry</td>
  </tr>
  <tr>
    <td rowspan="2"> john player </td>
    <td rowspan="2"> biba </td>
    <td rowspan="2"> bagit </td>
    <td> jack&jones </td>
  </tr>
  <tr>
    <td> peter england </td>
  </tr>
  <tr>
    <td rowspan="2"> us polo </td>
    <td rowspan="2"> Global desi </td>
    <td rowspan="2"> levis </td>
    <td rowspan="2"> spykar </td>
  </tr>
</table>


  [1]: http://i.stack.imgur.com/Y9TTK.png

答案 2 :(得分:1)

有一些名为“rowspan”和“colspan”的参数可以满足您的需求。

http://www.w3schools.com/Html/tryit.asp?filename=tryhtml_table_span