网络上是否有关于为广告横幅选择哪种 HTML 元素的权威信息?
我考虑过<article>
or <aside>
,但我认为更合适的只是:<div class="ad">
在大多数情况下我会使用aside element http://www.w3.org/TR/html5/sections.html#the-aside-element:
该元素可用于 [...]广告、[...] 以及被视为与页面主要内容分开的其他内容。
As the aside
element 是一个分段元素,即使您没有明确使用标题,它也会在文档大纲中创建一个条目。在大多数情况下,这就是您想要的。
如果您自己不托管广告,您可能希望将其包含在iframe http://www.w3.org/TR/html5/embedded-content-0.html#the-iframe-element:
这是一个使用以下内容的页面示例iframe
包括广告来自广告经纪人:
<iframe src="http://ads.example.com/?customerid=923513721&format=banner"
width="468" height="60"></iframe>
(在适当的情况下使用sandbox属性 http://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-sandbox为了安全。)
因此,一个简单的博客文章页面的结构可以如下所示:
<body>
<h1>My blog</h1>
<article>
<h1>My blog post</h1>
<p>…</p>
</article>
<nav>
<h1>Navigation</h1>
<!-- site-wide navigation -->
</nav>
<aside>
<h1>Advertisement</h1> <!-- or omit the heading altogether, it doesn't change the outline -->
<iframe></iframe>
<footer><small>Advertisement by ACME Inc.</small> <!-- or whatever --> </footer>
</aside>
</body>
页面有以下内容outline http://gsnedders.html5.org/outliner/:
- My blog
- 我的博文
- 导航
- 广告
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)