The <div> Tag in HTML 5
The div element is a generic container for flow content. It can be used to style the presentation of a block of HTML code. If the block of code is a section that should be included in the document outline, one of the sectioning tags should be used instead:
- <article> sectioning tag for an article
- <aside> sectioning tag for a sidebar
- <nav> tag for a navigation section such as a navigation toolbar with a drop-down menu, instead of
<div role="menu">
- <section> tag
There is also a generic container for phrasing content, the span element, which can be used to style inline HTML code.
The following demo makes use of a <div> tag to center an unordered list in its entirety so that the bullets will be in a nice straight vertical line and to style it with a blue outset border.
- Tina Fey
- Jane Lynch
- Kyra Sedgwick
- Andie MacDowell
- Laura San Giacomo
- Clare MacIntyre-Ross
- Kimberly Williams-Paisley
This is an actual working example of the <div> tag example code below.