6 ms·
Name Anchors has been a thing in HTML for a very long time (at least since HTML 2.0 spec [1], if not earlier). <a name="myanchor"><h3>Things to do</h3></a>
by vivegi 3y ago
Name Anchors has been a thing in HTML for a very long time (at least since HTML 2.0 spec [1], if not earlier).
<a name="myanchor"><h3>Things to do</h3></a>
If the CMS supports name anchors, you can just bookmark it as
https://example.com/foo.html#myanchor
Of course, authors are not mandated to follow named anchors for their document fragments, so this is just a best practice.
[1]: https://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.4 https://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.4
- austin-cheney 3y agoYou don’t need named anchors to accomplish the goal of URL fragments. ID attribute values on any element accomplish the same goal.
- vivegi 3y agoYes. The name/id choice recommendation has been evolving since the original HTML spec. For modern browsers (in 2023), you are right about the id attribute. Some very old browsers needed the name anchors.
- cookiengineer 3y agoPost JS build pipelines and web packers, most element names and classes are just minified garbage. Sadly most web devs don't give a damn about accessibility anymore :( Especially not in the React and Angular based ecosystems and toolchains. Server-side rendering was popular for a while, but even then the generated HTML codes were pretty useless for A11y focussed products.