Home >> HTML 5 >> What is Table Colspan and Rowspan in HTML 5

What is Table Colspan and Rowspan in HTML 5

HTML colspan attribute is used for specifies the number of columns a cell should span. 
It allows the single table cell to span the width of more than one cell or column. 
Note: colspan="2", 2 define number of "merge cell"
Example
<!Doctype Html>  
<html>     
<head>      
      <title>HTML table colspan</title>
</head>  
<body>   
<table width="200" height="200" border="1">
    <tr>
        <td>A</th>
        <td>B</th>
    </tr>
    <tr>
        <td>C</td>
        <td>D</td>
    </tr> 
    <tr>
        <td colspan="2">E</td>
    </tr>
</table>
</body>  
</html>  
 
HTML rowspan attribute is used for specifies the number of rows a cell should span. 
It allows the single table cell to span the width of more than one cell or column. 
Note: rowspan="2", 2 define number of "merge cell"
Example
<!Doctype Html>  
<html>     
<head>      
     <title>HTML table Rowspan</title>
</head>  
<body>   
<table width="200" height="200" border="1">
    <tr>
        <td>Name</th>
        <td>Age</th>
    </tr>
    <tr>
        <td>Ram</td>
        <td rowspan="2">24</td>
    </tr> 
    <tr>
        <td>shyam</td>
    </tr>
</table>
</body>  
</html>

Post Your Comment

Next Questions
What is Table Styling
What is Table Colgroup
How many type of Lists
What is Unordered Lists
What is Ordered Lists
What is Block and Inline Elements
What is HTML class Attribute
What is HTML id Attribute
What is HTML Iframes
What is HTML JavaScript
What is HTML File Paths
What is HTML Head Element
What is HTML Layout
What is HTML Responsive Website Design
What is HTML Forms
What is HTML Form Attributes
What is HTML Form Elements
What is HTML Input Types
What is HTML Input Attributes
What is HTML Input form attributes
What is HTML SVG Graphics
What is HTML Multimedia
What is HTML Video
What is HTML Audio
How to Embed YouTube Video

Copyright ©2022 coderraj.com. All Rights Reserved.