- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML caption Tag
The caption tag in HTML is used to create a caption for the table. Only one caption can be defined for a table. The default caption gets center aligned above the table. Let us now see an example to implement the caption tag in HTML −
Example
<!DOCTYPE html> <html> <head> <style> table, th, td { border − 2px solid blue; } </style> </head> <body> <table> <caption>Expenses</caption> <tr> <th>Domains</th> <th>Cost</th> </tr> <tr> <td>Product Development</td> <td>500000</td> </tr> <tr> <td>Marketing</td> <td>500000</td> </tr> <tr> <td>Services</td> <td>100000</td> </tr> <tr> <td>Support</td> <td>100000</td> </tr> <tr> <td>Maintenance</td> <td>100000</td> </tr> <tr> <td colspan="2">Total Budget = INR 1300000</td> </tr> </table> </body> </html>
Output
In the above example, we have created a table with columns. The caption is set using the <caption> tag −
<caption>Expenses</caption>
- Related Articles
- HTML DOM Caption Object
- HTML DOM Table caption Property
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML Tag
- HTML tag
- HTML Tag

Advertisements