Why should I use UL/LI in my HTML?

前端 未结 9 1275
长发绾君心
长发绾君心 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:22

    There are (at least) two good reasons to use lists. Using lists can help to give an idea of your site's structure which is good in terms of SEO but also if people use either custom CSS or screen readers for accessibility reasons. The second and slightly related one is that it's rather helpful when it comes to creating stylesheets. You don't need to come up with your own way of nesting elements. Just use lists and go from there. Then you can focus on getting the stylesheet right providing different styles for different hierarchy levels, first, last, odd or even list items.

    Content from this answer.

提交回复
热议问题