Performance: Title attribute
The title attribute affects page load minimally but can impact user experience by providing additional information on hover, which may trigger browser tooltip rendering.
<button aria-label="Submit the form">Submit</button>
<button title="Click to submit the form">Submit</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy use of title attributes on many elements | No extra DOM nodes | 0 reflows | Multiple paint triggers on hover | [!] OK |
| Use aria-label instead of title for accessibility | No extra DOM nodes | 0 reflows | No paint triggered by tooltip | [OK] Good |
title attribute do in HTML?title attribute is used to provide additional information about an element, which appears as a tooltip when the mouse hovers over it.title attribute's behavior.title='text'.title='This is a paragraph'. Options B, C, and D have syntax errors or missing quotes.<a href='https://example.com' title='Go to example'>Example</a>
title attribute on an anchor tag shows a tooltip with the given text when hovered.<button title=Click me>Press</button>
alt attribute provides text for screen readers and must describe the image meaningfully.title attribute adds hover text but does not replace the need for a descriptive alt.alt and matching title, which is best for accessibility and user info.Pass the test and this pattern moves unknown