
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
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>
- Related Articles
- How to set the number of rows a table cell should span in HTML?
- Set the number of columns to span in HTML
- How to specify the number of columns an element should be divided into with CSS
- Specify the number of columns in a CSS grid layout
- Set how many columns an element should span across with CSS
- Set how many columns an element should span across with JavaScript.
- How to specify the number of visible options for in HTML?
- How to specify that the details should be visible to the user in HTML?
- How do we specify whether a header cell is a header for a column, row, or group of columns or rows in HTML?
- How to merge table columns in HTML?
- How to find the number of columns in a MySQL table?
- How to include groups of table columns in HTML?
- How to specify whether the or the element should have autocomplete enabled in HTML?
- How do we display a table cell in HTML
- How to create table rows & columns in HTML?

Advertisements