HTML <div> Attributes
The <div> attribute is a block-level container that is used to group other HTML elements together for styling or create layout structures for specific functionalities or interactions. It does not have specific attributes but it can inherit and utilize a variety of common attributes available to HTML elements.
List of <div> Attributes
- id: This attribute assigns a unique identifier to the <div>, which can be used to reference the element in JavaScript or CSS.
- class: The class attribute assigns one or more class names to the <div>.
- style: The style attribute allows you to apply inline CSS styles directly to the <div> element.
- title: The title attribute provides additional information about the element, which is usually displayed as a tooltip when the user hovers over the element.
- data-*: The data attributes allow you to store custom data private to the page or application. The * can be replaced with any custom attribute name you want to use.
- aria-*: The ARIA attributes help improve accessibility for users with disabilities by providing extra information about the element.
- draggable: The draggable attribute specifies whether the element can be dragged by the user.