abbr.diverse different;divide separate;divided division;division division

html div tag syntax

Function:Define the partition or section (division/section) in the document.

Description:

is a block-level element. This means that its contents automatically start on a new line. In fact, line breaks are the only formatting behavior inherent to
. Additional styles can be applied via the
's class or id. It is not necessary to add a class or id to every
, although there are certain advantages to doing so. It is possible to apply either class or id attributes to the same
element, but it is more common to apply only one or the other. The main difference between the two is that class is used for groups of elements (similar elements, or can be understood as a certain type of elements), while id is used to identify individual and unique elements.

Note:

tag can divide the document into independent and different parts. It can be used as a strict organizational tool and does not use any formatting associated with it. The
tag is supported by all major browsers.

html div tag example

  

This is a header

This is a paragraph.

This is a header

This is a paragraph.


Run instance »

Click the "Run instance" button to view the online instance