THE BEST WEB DEVELOPER SITE

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():

Example

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

Try it Yourself »

Create a Caption Object

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

Example

var x = document.createElement("CAPTION");
Try it Yourself »

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

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.


Related Pages

HTML tutorial: HTML Tables

HTML reference: HTML <caption> tag

JavaScript reference: HTML DOM Table Object