Div and Span (<div>, <span>)
When To Use
Rules
- The <div> element is inherently considered to have a generic role, rather than none. This could potentially impact certain ARIA combination declarations, as they rely on the presence of a descendant element with a specific role in order to function correctly. 1
- The <div> element is recommended to be used solely when there is** no other suitable semantic element available**, such as <article> or <nav>. 1
- Avoid attempting to substitute every <div> or <span> with semantic elements, as elements that are exclusively employed for layout or styling objectives should not possess any additional semantic significance. 3
- The <span> element is similar to the <div> element, however, <div> elements are block-level elements whereas <span> elements are inline elements. 2
Sources
- MDN: <div>: The Content Division element by Mozilla contributors is licensed under CC-BY-SA 2.5
- MDN: <span>: The Content Span element by Mozilla contributors is licensed under CC-BY-SA 2.5
- Segunolalive: Improving Accessibility With DIV and SPAN by Segun Ola is licensed under Creative Commons Attribution 4.0 International License