Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

div — generic container

The `div` element groups content without special meaning. Choose it when no suitable semantic element applies.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

<div class="group">...</div>

div represents its children. It supports global attributes; class labels a group, while lang specifies its language. Both tags are required.

Normally, it appears where flow content is allowed and can contain flow content. As a dl child, it requires one or more dt followed by one or more dd, optionally interspersed with script-supporting elements. As an option, optgroup, or select descendant, its content model is transparent: surrounding context determines restrictions.

Prefer an appropriate semantic element, such as nav for navigation. The example groups two paragraphs sharing lang; class alone supplies no styling.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Grouping example</title>
</head>
<body>
  <div class="group" lang="en-GB">
    <p>Colour: blue.</p>
    <p>Size: small.</p>
  </div>
</body>
</html>

Result

Colour: blue.
Size: small.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources