HTML blocks
HTML <div> and <span>
HTML can combine elements through <div> and <span>.
HTML block elements
Most HTML elements are defined as either block-level elements or inline elements .
Block-level elements typically start (and end) on a new line when displayed by the browser.
Examples: <h1>, <p>, <ul>, <table>
HTML inline elements
Inline elements do not usually start on a new line when displayed.
Examples: <b>, <td>, <a>, <img>
HTML <div> element
The HTML <div> element is a block-level element that can be used as a container to group other HTML elements.
The <div> element has no special meaning. Besides that, because it’s a block-level element, the browser will display line breaks before and after it.
If used with CSS, the <div> element can be used to set style properties on large blocks of content.
Another common use of the <div> element is document layout. It replaces the older method of using tables to define layout. Using the <table> element for document layout is not a proper use of tables. The <table> element is intended for displaying tabular data.
HTML <span> element
The HTML <span> element is an inline element that can be used as a container for text.
The <span> element also has no specific meaning.
When used with CSS, the <span> element can be used to set style properties for a portion of text.
HTML grouping tags
Tag | Description |
---|---|
<div> | Define the area of the document, block-level. |
<span> | Used to combine inline elements in a document, inline elements |
IT Resource Hub » HTML blocks