- Published on
The difference between `<button>` tag and `<div>` tag
- Authors
- Name
- hwahyeon
<div> Tag
The <div>
tag is typically used as a general-purpose block element with no semantic meaning. It is commonly used for layout purposes or to group elements together. So, from an accessibility standpoint, the <div>
tag carries no inherent meaning.
<button> Tag
The <button>
tag has a clear semantic meaning, indicating a clickable button. It inherently provides support for interactions such as click, touch, and keyboard input like Enter and Spacebar keys. Additionally, the <button>
tag can receive focus and is accessible via keyboard navigation (e.g., using the Tab key). It is also recognized as a button by screen readers, making it more accessible for users who rely on assistive technologies.