HTML DOM Caption Object

Caption Object

The Caption object represents an HTML <caption> element.

Access a Caption Object

You can access a <caption> element by using getElementById():

var x = document.getElementById("myCaption");

Create a Caption Object

You can create a <caption> element by using the document.createElement() method:

var x = document.createElement("CAPTION");

Caption Object Properties

Property Description
align Not supported in HTML5. Use style.textAlign or style.captionSide instead.
Sets or returns the alignment of the caption

Standard Properties and Events

The Caption object also supports the standard properties and events.