开发者

table header inside another

开发者 https://www.devze.com 2023-03-17 18:37 出处:网络
i want to span a heading element to include another sub headingselements like that: <thead> <th rowspan=\"2\">main heading1</th>

i want to span a heading element to include another sub headings elements like that:

<thead>   
<th rowspan="2">main heading1</th>   
<th rowspan="2">main 开发者_运维问答heading2</th>   
<th colspan="3">main heading3
    <thead>
     <tr>
     <th>sub heading1</th>
     <th>sub heading2</th>
     <th>sub heading3</th>
     <tr>
    <thead>   
</th>   
<th rowspan="2">main heading4</th> 
</thead>

is that possible ?


If you want a table inside a table, you need to use the <table> element again. You can't just place another thead inside the thead. You're also missing <tr> tags and if you want a table inside a table using rowspan and colspan incorrectly.

Option 1: You could use 2 rows in your thead.

<thead>   
  <tr>
    <th rowspan="2">main heading1</th>   
    <th rowspan="2">main heading2</th>   
    <th colspan="3">main heading3</th>   
    <th rowspan="2">main heading4</th> 
  </tr>
  <tr>
    <th>sub heading1</th>
    <th>sub heading2</th>
    <th>sub heading3</th>
  </tr>
</thead>

Option 2: A table inside a table.

<thead>   
  <tr>
    <th>main heading1</th>   
    <th>main heading2</th>   
    <th>main heading3
      <table>
        <thead>
         <tr>
           <th>sub heading1</th>
           <th>sub heading2</th>
           <th>sub heading3</th>
         <tr>
        <thead>  
      </table> 
    </th>   
    <th>main heading4</th> 
  </tr>
</thead>
0

精彩评论

暂无评论...
验证码 换一张
取 消