我找到了HTML5的a page about sections and outlines。不是100%肯定它是官方的,页面说大多数浏览器都不遵循它,但我认为这是一个非常酷的主意,所以我试图创建明确插入隐式部分并创建轮廓的代码。
我所遇到的概念问题类似于隐式和显式切片混合的示例之一(缩写版本):
Mammals
Whales
...
Forest elephants
...
Mongolian gerbils
...
Reptiles
...
应该给出:
1. Mammals
1.1 Whales (implicitly defined by the h2 element)
1.2 Forest elephants (explicitly defined by the section element)
1.3 Mongolian gerbils (implicitly defined by the h3 element, which closes the previous section at the same time)
2. Reptiles (implicitly defined by the h2 element, which closes the previous section at the same time)
但是我遇到了麻烦(开始一个带有标题的部分,然后再使用不太深的标题)。考虑这个稍微修改过的例子:
Mammals
Whales
...
Forest elephants
...
Reptiles
...
Martians
Just being annoying
我该怎么处理?最后一个
应该在外部作用域的级别结束,该级别不存在。
(我个人认为,以