html - I couldn't figure out the table markup for this table -


enter image description here

i have tried layout table using rowspan , colspan last 2 hours , couldn't figure out, see if can solve puzzle.

here pen can see working solution: codepen

i added color make visible. construct table, here how did it:

  • first, have 4 rows.
  • in first one, have 4 cells, because start @ top.
  • one cell starts in second row, so, add 1 cell in second row.
  • one cell starts in third row, add 1 cell in third row.
  • one cell starts in last row, add 1 cell in last row.
  • then, need add rowspan="" accordingly scheme.

    table {    width:100%;    height: 400px;  }  tr:nth-child(1) td:nth-child(1){    background: #cceeee;  }  tr:nth-child(1) td:nth-child(2){    background: #eeccee;  }  tr:nth-child(2) td:nth-child(1){    background: #eecccc;  }  tr:nth-child(1) td:nth-child(3){    background: #ccccee;  }  tr:nth-child(3) td:nth-child(1){    background: #eeccee;  }  tr:nth-child(4) td:nth-child(1){    background: #eeccee;  }  tr:nth-child(1) td:nth-child(4){    background: #cceecc;  }  tr{    height:25%;  }
<table>    <tbody>      <tr>        <td rowspan="3">        </td>        <td>        </td>        <td rowspan="2">        </td>        <td rowspan="4">        </td>      </tr>      <tr>        <td rowspan="3">        </td>      </tr>      <tr>        <td rowspan="2">        </td>      </tr>      <tr>        <td>        </td>      </tr>    </tbody>  </table>


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -