HTML Block
HTML <div> and <span>
HTML can combine elements with <div> and <span>.
HTML Block Element
Most HTML elements are defined as block-level elements or inline elements .
When block-level elements are displayed in the browser, they usually start (and end) with a new line.
Example: <h1>, <p>, <ul>, <table>
HTML Inline Elements
Inline elements usually do not start with a new line when displayed.
Example: <b>, <td>, <a>, <img>
HTML <div> Element
The HTML <div> element is a block-level element, which can be used as a container for combining other HTML elements.
The <div> element has no specific meaning. In addition, since it is 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 attributes for large content blocks.
Another common use of the <div> element is document layout. It replaces the old-fashioned way of using tables to define layouts. Using the <table> element for document layout is not the correct usage of a table. The function of the <table> element is to display 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 also has no specific meaning.
When used with CSS, the <span> element can be used to set style attributes for part of the text.
HTML Group Tags
Label | Description |
---|---|
<div> | Defines the area of the document (block-level) |
<span> | Used to combine inline elements in the document (inline elements) |