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 Yourself »

Create a Div Object

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


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

Div Object Properties

Property 説明
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