HTML <caption> Tag

Advertisements


Description

The HTML <caption> tag is used for creating a caption for a table. There could be only one caption per table.

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML caption Tag</title>
</head>
<body>
<h2>Cricketers List</h2>
<table width="100%">
  <caption>Indian Cricketers</caption>
    <th>Name</th>
	<tr><td>Sachin Tendulkar</td></tr>
	<tr><td>M S Dhoni</td></tr>
	<tr><td>Suresh Raina</td></tr>
	<tr><td>Virat Kohli</td></tr>
</table>
</body>
</html>

This will produce following result:

Cricketers List

Indian Cricketers
Name
Sachin Tendulkar
M S Dhoni
Suresh Raina
Virat Kohli

Global Attributes

This tag supports all the global attributes described in - HTML Attribute Reference

Event Attributes

This tag supports all the event attributes described in - HTML Events Reference

Browser Support

ChromeFirefoxIEOperaSafariAndroid
YesYesYesYesYesYes

html_tags_reference.htm