Easy Tutorial
❮ Html Lists Html5 Webworkers ❯

HTML <div> and <span>


HTML can group elements together using <div> and <span>.


HTML Block Elements

Most HTML elements are defined as block-level elements or inline elements.

Block-level elements are typically displayed on the browser starting on a new line.

Examples: <h1>, <p>, <ul>, <table>


HTML Inline Elements

Inline elements are usually displayed without starting on a new line.

Examples: <b>, <td>, <a>, <img>


HTML <div> Element

The HTML <div> element is a block-level element and can be used as a container for other HTML elements.

The <div> element does not have a specific meaning. Additionally, being a block-level element, the browser displays a line break before and after it.

When used with CSS, the <div> element can be used to style large blocks of content.

Another common use of the <div> element is for document layout. It replaces the old method of defining layouts using tables. Using the <table> element for document layout is not its correct use. The <table> element is meant for displaying tabular data.


HTML <span> Element

The HTML <span> element is an inline element and can be used as a container for text.

The <span> element does not have a specific meaning.

When used with CSS, the <span> element can be used to style parts of text.


HTML Grouping Tags

Tag Description
<div> Defines a section in a document, block-level
<span> Used to group inline-elements in a document, inline
❮ Html Lists Html5 Webworkers ❯