HTML Block Elements and Inline Elements
- Previous Page HTML Lists
- Next Page HTML Classes
Elements can be combined using <div> and <span>.
HTML Block Elements
Most HTML elements are defined as block-level elements or inline elements.
Editor's note: 'Block-level element' is translated as 'block level element', and 'inline element' is translated as 'inline element'.
Block-level elements usually start on a new line (and end) when displayed in the browser.
Examples: <h1>, <p>, <ul>, <table>
HTML Inline Elements
Inline elements usually do not start on a new line when displayed.
Examples: <b>, <td>, <a>, <img>
HTML <div> Element
The HTML <div> element is a block-level element and is a container that can be used to combine other HTML elements.
The <div> element does not have a specific meaning. In addition, since it is a block-level element, the browser will display a line break 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 outdated method of defining layout using tables. Using the <table> element for document layout is not the correct usage of the <table> element. The purpose 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 does not have a specific meaning.
When used with CSS, the <span> element can be used to set style attributes for part of the text.
HTML Grouping Tags
Tag | Description |
---|---|
<div> | Definition of divisions or sections in the document. |
<span> | Definition of span, used to combine inline elements in the document. |
- Previous Page HTML Lists
- Next Page HTML Classes