These two elements, in combination with style sheets, are used to define the main layout of the content.
A <div> is a block level element, meaning it starts with a new line and usually groups larger structures together.
A <span> is an inline level element and it starts on the text level. It generally may contain only data such as text but not other block level elements.
Syntax:
<div></div>, <span></span>
Attributes:
- id, class (document-wide identifiers)
- lang (language information), dir (text direction)
- title (element title)
- style (inline style information)
- onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events)
Example
HTML grouping elements:
Comments
No comments have been made yet.
Please login to leave a comment. Login now