Welcome Login

Table td colspan and rolspan properties


Td tag colspan and rowspan properties:

colspan          Specifies the number of columns a cell should span

rowspan          Sets the number of rows a cell should span

 

 

Eg: colspan:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
  <table border=1>
    <tr>
      <td colspan="2">aaaaa</td>
    </tr>
    <tr>
      <td>aaaaa</td>
      <td>bbbbb</td>
    </tr>
  </TABLE>
</body> 
</html>

 

Outputs:

css-tablecolspan1

 

 

Eg2: rowspan:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
  <table border=1>
    <tr>
      <td>aaaaa</td>
      <td rowspan=2>bbbbb</td>
    </tr>
    <tr>
    <td>cccccc</td>
    </tr>
  </TABLE>
</body> 
</html>

 

Outputs:

css-tablerowspan1


Created on: Wednesday, November 20, 2013 by Andrew Sin