【发布时间】:2013-07-01 06:10:25
【问题描述】:
我已经阅读了一些关于 html5 大纲算法的文章,但这一篇让我感到困惑。
如果您将以下标记粘贴到此工具中:http://gsnedders.html5.org/outliner/
<body>
<nav>
<h1>Navigation</h1>
<ul>
<li>...</li>
</ul>
</nav>
<h1>My fantastic site</h1>
<h2>About me</h2>
<p>I am a man who lives a fascinating life. Oh the stories I could tell you...</p>
<h2>What I do for a living</h2>
<p>I sell enterprise-managed ant farms.</p>
<h1>Contact</h1>
<p>Shout my name and I will come to you.</p>
</body>
你会得到这样的大纲:
- 我的梦幻网站
- 导航
- 关于我
- 我靠什么谋生
- 联系方式
这很简单。导航是<body> 的子部分,因此出现在<body> 的<h1> 下方,就像所有h2 级标题一样。
但是看看下面的例子:
<body>
<nav>
<h1>Navigation</h1>
<ul>
<li>...</li>
</ul>
</nav>
<h1>My fantastic site</h1>
<figure><img src="" alt="" /><figure>
<h2>About me</h2>
<p>I am a man who lives a fascinating life. Oh the stories I could tell you...</p>
<h2>What I do for a living</h2>
<p>I sell enterprise-managed ant farms.</p>
<h1>Contact</h1>
<p>Shout my name and I will come to you.</p>
</body>
我在<h1> 和<h2> 之间添加了<figure> 元素,这似乎会影响http://gsnedders.html5.org/outliner/ 的轮廓。
大纲输出:
- 我的梦幻网站
- 导航
- 关于我
- 我靠什么谋生
- 导航
- 联系方式
所有 h2 级标题现在都是 <nav> 的后代,而不是 <body>。谁能解释为什么会这样?这是大纲工具中的某种错误吗?
谢谢
【问题讨论】:
标签: html markup outline outliner