14 of 133 menu

The div tag

The div tag defines a block that combines other tags. The tag itself does nothing, but when combined with the class and id attributes, it allows you to access a group of combined tags through CSS.

Example

Let's use the div tag to group several paragraphs and apply some styles to the group:

<div id="elem"> <p>text</p> <p>text</p> <p>text</p> </div> #elem { color: red; padding: 10px; border: 1px solid black; }

:

See also

  • tag span,
    which allows you to select a piece of text
  • tag section,
    which also groups tags
enru