HTML DOM Div Object


Div Object

The Div object represents an HTML <div> element.

Access a Div Object

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

var x = document.getElementById("myDIV"); Try it

Create a Div Object

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

var x = document.createElement("DIV"); Try it

Div Object Properties

Property Description
align Not supported in HTML5. Use style.textAlign instead.
Sets or returns the value of the align attribute of the <div> element

Standard Properties and Events

The Div object also supports the standard properties and events.


Related Pages

HTML tutorial: HTML Blocks

HTML reference: HTML <div> tag