Name
<DIV> — NN all IE all HTML 3.2
Synopsis
<DIV>...</DIV>
End Tag: Required
The DIV
element gives structure and context to any block-level content in a
document. Unlike some other structural elements that have very
specific connotations attached to them (the P
element, for instance), the author is free to give meaning to each
particular DIV element by virtue of the
element’s attribute settings and nested content. Each
DIV element becomes a generic block-level
container for all content within the required start and end tags.
As a basic example, the DIV element is now
recommended as the element to use to center text on a page, in place
of the deprecated CENTER element. The
DIV element that does the work includes style
information that takes care of the centering of the content. It is
also convenient to use the DIV element as a
wrapper for multielement content that is to be governed by a single
style sheet rule. For example, if a block of content includes three
paragraphs, rather than assign a special font style to each of the
P elements, you can wrap all three
P elements with a single DIV
element whose style sheet defines the requested font style. Such a
style sheet could be defined as an inline STYLE
attribute of the DIV element or assigned via the
CLASS or ID attribute,
depending on the structure of the rest of the document.
DIV elements are block-level elements. If you need
an arbitrary container for inline content, use the
SPAN element, instead.
HTML 4.0 defines many more attributes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access