html – 为什么常用于构建网站导航?

为什么通常用于构建网站导航的无序列表与使用有序列表相反,或者只是创建作为一个组放置在另一个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)标记.

the CSS specification开始:

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.

大多数网站都提供了一个部分列表,但您访问这些部分的顺序无关紧要.这意味着列表项的顺序并不重要,因此它应该是无序的链接列表,而不是有序的链接列表.

相关文章

HTML代码中要想改变字体颜色,常常需要使用CSS样式表。CSS是...
HTML代码如何让字体盖住图片呢?需要使用CSS的position属性及...
HTML代码字体设置 在HTML中,我们可以使用标签来设置网页中的...
在网页设计中,HTML代码的字体和字号选择是非常重要的一个环...
HTML(Hypertext Markup Language,超文本标记语言)是一种用...
外链是指在一个网页中添加一个指向其他网站的链接,用户可以...