HTML Anchors with ids

Despite being in the HTML 4.01 spec since 1999 I picked up another small frontend tip recently. When adding anchors on a page for the purpose of in-page links my typical method for years has been to add a link with the anchor name in the href and an anchor tag with a name attribute. <a href="#productList">View more products</a> Some page content… <a name="productList"></a> <ul class="productList">…</a> Just the other day @ry5n informed me that a link that corresponds to an elements id will work just the same and there’s no need to add an additional anchor with a name.

Continue reading

Author's picture

Brian Pearce

Software Developer, Endurance Cyclist,
Rubiest, Rustacean, and Gopher

Software Engineer

Barcelona, Spain