THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

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

Example

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

Create a Div Object

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

Example

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

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