HTML DOM Caption Object

Caption Object

The Caption object represents the HTML <caption> element.

Access Caption Object

You can use getElementById() to access the <caption> element:

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

Try it yourself

Create Caption Object

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

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

Try it yourself

Tip:You can also use the createCaption method of the Table object to create a <caption> element.

Caption Object Properties

Properties Description
align

HTML5 does not support. Please use style.textAlign or style.captionSide.

Sets or returns the alignment of the title.

Standard Properties and Events

Caption Object Supports StandardsPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Table

HTML Reference Manual:HTML <caption> Tag

JavaScript Reference Manual:HTML DOM Table Object