将表格单元格分割成HTML中的两列

将表格单元格分割成HTML中的两列,第1张

概述我有下表: <table border="1"> <tr> <th scope="col">Header</th> <th scope="col">Header</th> <th scope="col">Header</th> </tr> <tr> <th scope="row"></th> <td></td> < 我有下表:
<table border="1">  <tr>    <th scope="col">header</th>    <th scope="col">header</th>    <th scope="col">header</th>  </tr>  <tr>    <th scope="row">&nbsp;</th>    <td>&nbsp;</td>    <td>Split this one into two columns</td>  </tr></table>

而且我希望将包含“将其分成两列”的单元格拆分成两个单元格/列。我该怎么做?

Fiddle

解决方法 像这个 http://jsfiddle.net/8ha9e/1/

将colspan =“2”添加到第三个<然后在您的第二行有4 td。

<table border="1">  <tr>    <th scope="col">header</th>    <th scope="col">header</th>    <th scope="col" colspan="2">header</th>  </tr>  <tr>    <th scope="row">&nbsp;</th>    <td>&nbsp;</td>    <!-- The following two cells will appear under the same header -->    <td>Col 1</td>    <td>Col 2</td>  </tr></table>
总结

以上是内存溢出为你收集整理的将表格单元格分割成HTML中的两列全部内容,希望文章能够帮你解决将表格单元格分割成HTML中的两列所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1114050.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存