1.5 Attributes Flashcards
(8 cards)
What are HTML attributes?
Additional information added to elements using name/value pairs (e.g, id=”main”).
How do you set the language of an HTML document?
With the lang attribute in <html lang="en">.
What does the title attribute do?
It provides extra information shown as a tooltip on hover.
What is the id attribute used for?
Assigns a uniqe indentifier to an HTML element, useful for CSS & JavaScript.
What is the class attribute used for?
Assigns one or more class names to an element for styling & scripting.
Can an element have both id & class attributes?
Yes, an element can have both for unique targeting & shared styles.
Are HTML attribute values case-sensitive?
Attribute names are not case-sensitive, but values may be, depending on context.
What is the syntax for writing an attribute?
attribute=”value” inside an opening tag, e.g, <p title="Hello">.