Are the <ul> and <li> tags necessary in the HTML5 <nav> element?
-
Is there any benefit to creating a navigation menu like... <nav> <ul> <li><a href="#">...</a></li> <li><a href="#">...</a></li> </ul> </nav> ...or is that just a relic from older HTML versions? With HTML5, is it more effective to just do... <nav> <a href="#">...</a> <a href="#">...</a> </nav> ...as shown on W3School's HTML5 tutorial? Can't the <ul> and <li> tags be dropped completely?
-
Answer:
As usual, do what semantically makes sense! Forget about the nav for a second, if it makes sense to put your navigation in an unordered list, then do it. For instance, if I had an introductory h1 tag at the top of my site and the navigation followed shortly afterward, I might want to put that in a list as it may briefly describe my entire website. If these items were not in a list, they would be indifferentiable contextually. But nav kind of solves that problem by saying elements on this level belong to some sort of navigation. But the nav doesn't tell a whole lot. It doesn't even guarantee that we only have anchor tags in it. Maybe our navigation consists of buttons or some links and some helper text. So, I think it kind of makes sense to be explicit and put your links in your navigation in a unordered-list. Because nav doesn't replace the list element, it's just further content organization. Also, what if you have sub-menus? Lists describe menus with sub-navigation pretty well and they give a clear hierarchy. So, in short, it's all about the meaning. This: <nav> <a href="...">...</a> <a href="...">...</a> </nav> Has different meaning than this: <nav> <ul> <li><a href="...">...</a></li> <li><a href="...">...</a></li> </ul> </nav> Lists summarize some content.
John Fawcett at Quora Visit the source
Other answers
If you want to make a table by unordered list then <li> tag is the right choice. item list will be marked by bulltes.Its syntax is:- (For make table in HTML)<ul><li></li><li></li><li></li></ul>If you are also searching for IT company then I think http://www.joviinternational.com/ is the right place. This is providing the affordable services for web design & development, Android Apps development, etc. in all over India.
Suresh Kumar
Related Q & A:
- What's the proper structure of an HTML5 page that briefly lists other articles?Best solution by Webmasters
- How to convert special tags into html tags?Best solution by Stack Overflow
- How to style the HTML5 form validation messages?Best solution by Stack Overflow
- Should I leave my higher paying (65K plus possible bonus) private sector job for a (62.5K) Federal government job?Best solution by Yahoo! Answers
- Can the Li-ion battery from my camera be charged by ANY Li-ion battery charger without any risks?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.