Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to specify the number of columns a table cell should span in HTML?
Use the colspan attribute to set the number of columns a table cell should span. You can try to run the following code to implement colspan attribute −
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<h2>Total Marks</h2>
<table>
<th>Subject</th>
<th>Marks</th>
<tr>
<td>Maths</td>
<td>300</td>
</tr>
<tr>
<td>Java</td>
<td>450</td>
</tr>
<tr>
<td colspan="2">Total Marks: 750</td>
</tr>
</table>
</body>
</html>Advertisements