3 ms·
Except in many cases, an ID can be replaced these days with an HTML5 tag that can be re-used, or with other attributes, e.g. aria ones, that mean more. And you
by lstamour 11y ago
Except in many cases, an ID can be replaced these days with an HTML5 tag that can be re-used, or with other attributes, e.g. aria ones, that mean more.
And you might run into a circumstance where you have to repeat the header or footer -- perhaps you're allowing someone to edit the header or footer of your site and you want to do so in the middle of the page? Or you want to perform a complex animation that would require having multiple elements on the page at the same time. IDs ultimately are more brittle, and they don't do anything to enforce that they're only used once on a page. Their best use appears to be for hyperlinks or perhaps actual ID numbers (e.g. JavaScript) and not much else these days, if you're being consistent.