When writing in HTML, the
tag is a block element used to divide or section off content on a web page. It is useful for grouping block-level elements together so they can be formatted simultaneously using CSS. When adding text to a
tag, if the text length is longer than the
width, the text automatically wraps to the next line.
The following sections contain information about this tag including an example of it in use, and related attributes and browser compatibility.
Example ofcode
#This content is in its own <div> element
You can put any element into a div, which is excellent.
Example result#
Deprecated attributes#
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. Every attribute unique to the
tag is deprecated, meaning that it may function currently, but is not supported in going forward. In this case, CSS should be used in place of this attribute.
The
tag should only be used when there is not a more appropriate element, such as