Use rowspan to span rows to several rows

Description

To span cell to multiple rows, you can use the rowspan attribute. The value you assign to this attribute is the number of rows to span.

The values assigned to the rowspan must be integers.

If you want one cell in the middle column to span all three rows, you apply the rowspan attribute to cell 2.

You also have to remove the cell elements that the expanded cell will cover.

Example

The following code expands a Cell to Cover Multiple Rows.


<!DOCTYPE HTML>
<html>
<head>
<style>
td {<!--  ww w.  j a va  2s  .c  om-->
  border: thin solid black;
  padding: 5px;
  font-size: x-large
}
</style>
</head>
<body>
  <table border='1'>
    <tr>
      <td>1</td>
      <td rowspan="3">2</td>
      <td>3</td>
    </tr>
    <tr>
      <td>4</td>
      <td>6</td>
    </tr>
    <tr>
      <td>7</td>
      <td>9</td>
    </tr>
  </table>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed