Pra*_*hta 11 seo html5 accessibility semantic-markup
假设aside元素包括"哦,顺便说一下......"等内容,例如阅读建议,广告或交叉销售.
aside外面是否在语义上可以main吗?aside不在外面,它是否优于可访问性main,例如"跳到主要内容"命令?aside在外面或内部包含标签,是否有任何SEO影响main.uno*_*nor 17
在HTML5中,它仅定义aside为"与aside元素周围的内容相关".
在HTML 5.1(CR)中,定义变得更加具体,因为它现在说aside"与父母分区内容的内容相关 ".
在更新的定义之后,aside元素应该在与其相关的section元素的内部.的main元件是不一个切片元件(相似的元件article,section,body,figure等是).当然,你可以仍然放置aside在main,但它会涉及到最近的切片元素的父main.
这意味着aside在这两个例子中没有语义差异(for ):
<body>
<main></main>
<aside><!-- related to the body --></aside>
</body>
Run Code Online (Sandbox Code Playgroud)
<body>
<main><aside><!-- related to the body --></aside></main>
</body>
Run Code Online (Sandbox Code Playgroud)
显示几个不同情况的示例:
<body>
<main>
<article>
<aside><!-- related to the article --></aside>
<section>
<aside><!-- related to the section --></aside>
<blockquote>
<aside><!-- related to the blockquote (not to the section!) --></aside>
</blockquote>
<div>
<aside><!-- related to the section (not to the div!) --></aside>
</div>
</section>
</article>
<aside><!-- related to the body (not to the main!) --></aside>
</main>
<aside>
<!-- related to the body -->
<aside><!-- related to the (parent) aside --></aside>
</aside>
<nav>
<aside><!-- related to the nav --></aside>
</nav>
<footer>
<aside><!-- related to the body (not to the footer!) --></aside>
</footer>
</body>
Run Code Online (Sandbox Code Playgroud)
如果你<aside>的内容与你的内容直接相关,<main>那么我会把它留在<main>.现在,据说......
<aside>在外面使用<main>(例如,它是有效的,但你的内容可能另有保证).<aside>之外<main>有没有危害,也不利于可访问性.只要你遵循良好的结构和有效的加价,你应该没事.<aside>外面<main>,也有<aside>内部<main>,我看到我的排名没有差别.鉴于搜索引擎通常对这样的特定位不透明,如果您担心,我会考虑进行一些A/B测试.来自HTML5 Doctor的相关资料,由HTML5规范编辑之一编写: