为什么通常用于构建网站导航的无序列表与使用有序列表相反,或者只是创建作为一个组放置在另一个id元素中的div id?也许它是以前版本的html / css的遗留物,我太年轻了,或者可能是
CSS3控制增加的结果,但我总是这样做,从来没有真正质疑为什么:
<ul> <li><a href="#">Nav Item 1</a></li> <li><a href="#">Nav Item 2</a></li> <li><a href="#">Nav Item 3</a></li> <li><a href="#">Nav Item 4</a></li> </ul>
任何见解将不胜感激.
解决方法
菜单是链接列表.
由于它是一个列表,因此应使用列表标记来表示,而不是通用块(div)标记.
Note. CSS gives so much power to the “class” attribute,that authors could conceivably design their own “document language” based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the “class” attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not.
大多数网站都提供了一个部分列表,但您访问这些部分的顺序无关紧要.这意味着列表项的顺序并不重要,因此它应该是无序的链接列表,而不是有序的链接列表.