应该将导航栏始终实现为列表吗? [英] Should navigation bars always be implemented as lists?

查看:159
本文介绍了应该将导航栏始终实现为列表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,非常抱歉,如果这不是一个真正的stackoverflow问题。但它是我一直想知道的东西...

Firstly, very sorry if this is not a "true" stackoverflow question. But it's something I've always wondered about...

当你编写一个网站的导航栏(html)我读过这是非常好的做法,如果不是唯一的做法来实现它使用列表标签。例如

When you code a navigation bar for a site (html) I've read that it is very good practice, if not the ONLY practice to implement it using the list tag. e.g.

<ul>
    <li> Home </li>
    <li>About Us</li>
    <li>Blog</li>
    <li>Contact Us</li>
</ul>

然后应用水平显示列表的必要样式,依此类推。

And then apply the necessary styling that displays the list horizontally and so on and so forth.

但是这个标准设置在石头上,或者只有这样做,如果这是最好的选择,这样做...因为目前我有一个导航栏,这是不是你的标准的nv吧,可以这么说,它是一个有点的任务实现它作为一个列表。放在一些div中的几个链接标签将很好地工作。但是,我当然不想这样做,如果它会让人点和笑我... ...

But is this standard set in stone or does one only do it this way if it's the best option to do so... Because currently I have a navigation bar to do that is not your 'standard' nv bar so to speak, and it's a little bit of a mission to implement it as a list. A few link tags placed in some divs will work nicely. But of course I do not want to do this that method if it's going to make people point and laugh at me...

提前感谢!

推荐答案

为什么要使用列表进行网站导航?

使用Web标准设计网站涉及使用语义正确的代码。引用头脑风暴和狂欢

Part of designing a site using web standards involves the use of semantically correct code. To quote "Brainstorms and Raves":

>良好的HTML结构基于逻辑,顺序和使用语义正确的标记。如果您有一个标题使用heading元素,从H1元素开始。如果你有一个段落,使用一个段落元素。如果您有列表,请使用列表项元素。

在结构层面,网站导航只是指向网站其他区域的链接列表。因此,标记网站导航的最佳方法是(可以说)使用列表元素。

At a structural level, site navigation is simply a list of links to other areas of the site. Therefore, the best method for marking up site navigation is (arguably) to use a list element.

如果您使用好的HTML结构,那么基于文本的浏览器,屏幕阅读器,非CSS支持的浏览器,CSS关闭的浏览器和搜索bot可以更容易地访问您的内容。

If you use good HTML structure, then text-based browsers, screen readers, non-CSS supporting browser, browsers with CSS turned off and search bots will be able to access your content more easily.

一个很好的文章是在这里

这篇关于应该将导航栏始终实现为列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆