Why should I use UL/LI in my HTML?

前端 未结 9 1254
长发绾君心
长发绾君心 2021-02-13 13:04

I have the following structure that seems really nice for me and I always use HTML5:


      
9条回答
  •  说谎
    说谎 (楼主)
    2021-02-13 13:34

    The opinions from a blind person using the JAWS screen reader suggests not using ul and li elements for menu or navigation lists.

    https://css-tricks.com/navigation-in-lists-to-be-or-not-to-be/

    Although you should nest the anchor elements inside a nav element if it is a navigation menu of some kind... that is its options will lead the user to new views/pages. If it is just a list of non-interactive data, then perhaps a section or aside element would work.

    For a list of elements with interactive options that don't lead to a new page (i.e. just send a get/post request) its less clear what to wrap it in. I think a nav element could still make sense semantically (you're navigating the database/CRUD aspect of the page), or just a section/aside element could still work.

    There's partial support for a menu element that would be nice for that :(

提交回复
热议问题