html - 登录/注册链接是 HTML5 <menu> 的语义用例吗

标签 html semantic-markup

Live Example

HTML5 <menu> element

HTML5:

<menu type="list">
  <li><a href="/signup/"> Sign Up </a></li>
  <li><a href="/login/"> Log In </a></li>
</menu>

我想在我的网站上添加一个注册/登录菜单。

  • 会使用 <menu>是语义?
  • 我应该使用 <ul> 吗?相反?

编辑:我使用的是语义 HTML5。浏览器支持无关紧要。

最佳答案

我相信你已经知道了:

The menu element represents a list of commands.

这实际上仅取决于您如何定义“列表”和“命令”。 “登录”和“注册”是命令吗?或者它们是列表项?我个人认为它们是命令。列表(ulol)更类似于更长的东西,对我来说,两个项目似乎不构成列表。登录和注册看起来像命令,因为它们是 Stephen Krug 在 Don't Make Me Think 中的内容调用“实用程序”:

Utilities are links to important elements of the site that aren't really part of the content hierarchy.

这些与他所谓的“部分”形成对比:

links to the main sections of the site: the top level of the site's hierarchy [navigation]

这在语义上是有道理的:你使用 <nav> Krug 的“部分”(导航)和 <menu>用于实用程序或命令(登录、注册、搜索等)

关于html - 登录/注册链接是 HTML5 <menu> 的语义用例吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7018807/

相关文章:

html - "statusbar"的语义正确的 HTML 元素是什么?

html - 社交链接是否进入 <nav> 元素的语义

php - Codeigniter - 在数组未显示在表单编辑中时制作下拉菜单

html - 动态设置具有动态高度的绝对 DIV?

javascript - Atom 或 VS Code 等文本编辑器中使用的基本组件是什么?

html - 考虑到 Web 标准和语义,在编写事件列表时,我应该使用有序列表还是无序列表?

html - CSS: float 、绝对位置和溢出

html - 当浏览器小于内容时添加空格

html - <label>的语义也用出了一个<form>?

css - 为什么 <big> 不在 HTML 5 标签列表中而 <small> 在?