This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

caption

Summary

Gets or sets the caption element of a table.

Property of dom/HTMLTableElementdom/HTMLTableElement

Syntax

var captionElement = table.caption;
table.caption = newCaption;

Return Value

Returns an object of type DOM NodeDOM Node

The caption element, or null.

Examples

This example sets the inline style for the caption property.

document.getElementById("mytable").caption.style.color = "blue";

Notes

If a table contains multiple captions, this property returns the first one.

Related specifications

DOM Level 1
Recommendation

Attributions