HTML < div > and < span >
HTML can combine elements through <div>
and <span>
.
HTML block element
Most HTML elements are defined as block-level or inline elements.
When block-level elements are displayed in a browser, they usually start (and end) with a new line.
Example: <h1>
, <p>
, <ul>
, <table>
HTML inline elements
Inline elements are usually displayed without starting with a new line.
Example: <h1>
, <p>
, <ul>
, <table>
HTML < div > element
HTML <div>
elements are block-level elements that can be used to combine containers of other HTML elements.
<div>
elements have no specific meaning. In addition, because it is a block-level element, the browser displays line breaks before and after it.
If used with CSS <div>
element can be used to set style attributes on large blocks of content.
<div>
another common use of elements is document layout. It replaces theold-fashioned method of using tables to define layouts. Use <table>
element for document layout is not the correct use of tables. The <table>
purpose of the element is to display tabulated data.
HTML < span > element
HTML <span>
elements are inline elements that can be used as containers for text
The <span>
element also has no specific meaning.
When used with CSS <span>
element can be used to set style properties for part of the text.
HTML grouping label
Label |
Description |
---|---|
< div > |
Defines the area of the document, block level |
< span > |
Used to combine inline elements in a document, inline elements (inline) |