记录多头表头的表格

本文探讨了如何在前端开发中处理多头表头的表格,详细介绍了实现这种复杂表格布局的方法,包括使用HTML、CSS和JavaScript的技巧,以及如何确保数据的可维护性和用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述

<body>
    <table id="tab" cellpadding="1" cellspacing="1" border="1">
        <tr>
            <th rowspan="3">序号</th>
            <th rowspan="3">监测位置</th>
            <th rowspan="3">供电通路</th>
            <th rowspan="3">供电电压</th>
            <th rowspan="3">负载电流</th>
            <th rowspan="3">雷击次数</th>
            <th rowspan="3">最近一次雷击时间</th>
            <th colspan="3">后备保护空开状态</th>
            <th rowspan="3">SPD损害数量</th>
            <th colspan="3">输出空开状态</th>
        </tr>
        <tr>
            <th>B级</th>
            <th>C级</th>
            <th>1路</th>
            <th>2路</th>
        </tr>
        <tr>
            <th>B级</th>
            <th>C级</th>
            <th>1路</th>
            <th>2路</th>
        </tr>
        <tr>
            <td rowspan="4">1</td>
        </tr>
        <tr>
            <td>1</td>
            <td>78</td>
            <td>96</td>
            <td>67</td>
            <td>98</td>
            <td>88</td>
            <td>75</td>
            <td>94</td>
            <td>69</td>
            <td>23 </td>
            <td>33 </td>
        </tr>
        <tr>
            <td colspan="2">提示建议</td>
            <td colspan="2">智能防雷箱状态</td>
            <td colspan="2">防雷箱型号</td>
            <td colspan="3">防雷箱序列号</td>
            <td colspan="2">防雷箱版本</td>
        </tr>
        <tr>
            <td colspan="2">建议整机按规程检测</td>
            <td colspan="2">在线</td>
            <td colspan="2">2018041201-035PF</td>
            <td colspan="3">2018041201-256</td>
            <td colspan="2">V1.0.0</td>
        </tr>
    </table>

    <table border="1px" cellspacing="0" cellpadding="15px">
        <thead>
            <tr>
                <th rowspan="2">1</th>
                <th rowspan="2">2</th>
                <th rowspan="2">3</th>
                <th rowspan="2">4</th>
                <th rowspan="2">5</th>
                <th rowspan="2">6</th>
                <th rowspan="2">7</th>
                <th rowspan="2">8</th>
                <th rowspan="2">9</th>
                <th rowspan="2">10</th>
                <th rowspan="2">11</th>
                <th rowspan="2">12</th>
                <th rowspan="2">13</th>
                <th rowspan="2">14</th>
                <th rowspan="2">15</th>
                <th align="center" colspan="2">16</th>
                <th align="center" colspan="2" rowspan="2">17</th>
                <th rowspan="2">18</th>
                <th rowspan="2">19</th>
            </tr>
            <tr>
                <th>a</th>
                <th>b</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td rowspan="2">张三</td>
                <td rowspan="2">12</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td colspan="2" rowspan="2">2222</td>
                <td>父亲</td>
                <td>母亲</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
            </tr>
            <tr>
                <td align="center" colspan="2">务农</td>
            </tr>
        </tbody>
    </table>
    <table border="1px" cellspacing="0" cellpadding="15px">
        <thead>
            <tr>
                <th rowspan="2">1</th>
                <th rowspan="2">2</th>
                <th rowspan="2">3</th>
                <th rowspan="2">4</th>
                <th rowspan="2">5</th>
                <th rowspan="2">6</th>
                <th rowspan="2">7</th>
                <th rowspan="2">8</th>
                <th rowspan="2">9</th>
                <th rowspan="2">10</th>
                <th rowspan="2">11</th>
                <th rowspan="2">12</th>
                <th rowspan="2">13</th>
                <th rowspan="2">14</th>
                <th rowspan="2">15</th>
                <th align="center" colspan="2">16</th>
                <th align="center" rowspan="2">17</th>
                <th rowspan="2">18</th>
                <th rowspan="2">19</th>
            </tr>
            <tr>
                <th>a</th>
                <th>b</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td rowspan="2">张三</td>
                <td rowspan="2">12</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
                <td colspan="2" rowspan="2">2222</td>
                <!-- <td>父亲</td>
                <td>母亲</td> -->
                <td>
                    <table border="1px" cellspacing="0">
                        <tr>
                            <td>父亲</td>
                            <td>父亲</td>
                        </tr>
                        <tr>
                            <td colspan="2">务农</td>
                        </tr>
                    </table>
                </td>
                <!-- <td>
                    <table  border="1px" cellspacing="0">
                        <tr>
                            <td>父亲</td>
                            <td>父亲</td>
                        </tr>
                        <tr>
                            <td colspan="2">务农</td>
                        </tr>
                    </table>
                </td> -->
                <td rowspan="2">男</td>
                <td rowspan="2">男</td>
            </tr>
            <!-- <tr>
                <td align="center" colspan="2">务农</td>
            </tr> -->
        </tbody>
    </table>

<table id="tab" cellpadding="1" cellspacing="1" border="1">
      <tr>
        <th rowspan="2">序号</th>
        <th colspan="2">王五</th>
        <th colspan="2">李四</th>
        <th colspan="2">孙传</th>
        <th colspan="2">胡平</th>
        <th rowspan="2">合计</th>
      </tr>
      <tr>
        <th>语文</th>
        <th>数学</th>
        <th>语文</th>
        <th>数学</th>
        <th>语文</th>
        <th>数学</th>
        <th>语文</th>
        <th>数学</th>
      </tr>
      <tr>
        <th>1</th>
        <th>78</th>
        <th>96</th>
        <th>67</th>
        <th>98</th>
        <th>88</th>
        <th>75</th>
        <th>94</th>
        <th>69</th>
        <th> </th>
      </tr>
      <tr>
        <th>2</th>
        <th>89</th>
        <th>68</th>
        <th>77</th>
        <th>87</th>
        <th>84</th>
        <th>76</th>
        <th>71</th>
        <th>87</th>
        <th> </th>
      </tr>
      <tr>
        <th>3</th>
        <th>75</th>
        <th>78</th>
        <th>89</th>
        <th>74</th>
        <th>65</th>
        <th>68</th>
        <th>98</th>
        <th>90</th>
        <th></th>
      </tr>
      <tr>
        <th>4</th>
        <th>79</th>
        <th>89</th>
        <th>65</th>
        <th>62</th>
        <th>64</th>
        <th>87</th>
        <th>97</th>
        <th>91</th>
        <th></th>
      </tr>
      <tr>
        <th>5</th>
        <th>89</th>
        <th>96</th>
        <th>67</th>
        <th>76</th>
        <th>74</th>
        <th>84</th>
        <th>67</th>
        <th>81</th>
        <th></th>
      </tr>
      <tr>
        <th>6</th>
        <th>94</th>
        <th>90</th>
        <th>97</th>
        <th>74</th>
        <th>62</th>
        <th>81</th>
        <th>78</th>
        <th>78</th>
        <th></th>
      </tr>
      <tr>
        <th>7</th>
        <th>78</th>
        <th>89</th>
        <th>77</th>
        <th>87</th>
        <th>45</th>
        <th>86</th>
        <th>77</th>
        <th>98</th>
        <th></th>
      </tr>
      <tr>
        <th>8</th>
        <th>65</th>
        <th>67</th>
        <th>94</th>
        <th>68</th>
        <th>87</th>
        <th>69</th>
        <th>78</th>
        <th>68</th>
        <th></th>
      </tr>
      <tr>
        <th>9</th>
        <th>86</th>
        <th>98</th>
        <th>87</th>
        <th>87</th>
        <th>65</th>
        <th>78</th>
        <th>98</th>
        <th>79</th>
        <th></th>
      </tr>
      <tr>
        <th>10</th>
        <th>88</th>
        <th>75</th>
        <th>77</th>
        <th>97</th>
        <th>97</th>
        <th>77</th>
        <th>70</th>
        <th>87</th>
        <th></th>
      </tr>
   </table>
</body>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值