HTML Navigation Bar

Normally when I code a navigation I use for example:
< nav >
< ul >
< li > < a href=“#” >Home< /a > < /li >
< li > < a href="# ">About< /a > < /li >
< /u >
</ nav>
I want to know if maybe is better to avoid the use of the < ul > and < li > tag.

Using <ul> and <li> tags for navigation is a common practice as it semantically represents a list of links, which is beneficial for accessibility and SEO. However, if you prioritize a more streamlined HTML structure or if the navigation doesn’t logically represent a “list” of items, you might opt to omit these tags and directly use <a> tags within the <nav> element. This approach can simplify the markup and styling but may slightly diminish the semantic clarity of the document structure for screen readers and search engines. The decision should be based on the specific needs of your project though as, from my knowledge, there isn’t a set what to go around it.

1 Like