Attributes Flashcards
What is the purpose of name/value pairs in HTML?
They appear in the opening tag and provide information about the functionality or element.
What are global attributes in HTML?
Global attributes can appear in any HTML element.
What are element-specific attributes?
Element-specific attributes apply to a specific element.
Which HTML attributes are case-sensitive?
The id
and class
attributes are case-sensitive.
How do boolean attributes behave in HTML?
Boolean attributes are always true if present and omitted if false.
What are enumerated attributes in HTML?
Enumerated attributes have limited predefined values with a default value and are not automatically true if omitted.
What is the purpose of the id
attribute in HTML?
The id
attribute uniquely identifies elements, useful for linking, scripting, accessibility, and styling. It is case-sensitive and unique across the document.
How does the for
attribute in <label>
work?
The for
attribute links the label to the form control’s id
, providing accessibility and better form interaction.
What is the role of the class
attribute in HTML?
The class
attribute is used to target elements with CSS, with its value being a space-separated list of case-sensitive classes.
What does the style
attribute do in HTML?
The style
attribute applies inline CSS styles to the element.
What is the purpose of the tabindex
attribute?
The tabindex
attribute enables an element to receive focus, with integer values (e.g., -1 for no focus).
What does the role
attribute do in HTML?
The role
attribute provides semantic meaning to content without affecting browser behavior.
What is the purpose of the data-
prefix in HTML?
The data-
prefix allows the creation of custom attributes, which can store extra information on HTML elements.