Div and Span Tags

HTML has two tags, <div> and <span>, that are often used just for styling. The <span> tag in fact does nothing by itself. The <div> tag does nothing more than separate its contents onto a separate line.

These tags are useful for grouping text for styling purposes. They will usually have a class attribute whose value is just a name used to specify how it is styled.

The example below uses the class for <div> tags to set their text indent. The class for <span> tags sets their background color.

<tag-name attributes-list>
content
</tag-name>