网路上是否有任何关于选择广告横幅的HTML元素的权威资讯?
我考虑了<article>
或<aside>
,但我认为更合适的方法是:<div class="ad">
最佳答案
在大多数情况下,我会使用 aside
element:
由于aside
元素是一个sectioning元素,因此即使您没有显式使用标题,它也会在文档大纲中创建一个条目。在大多数情况下,这就是您想要的。
如果您自己没有托管广告,则可能希望将其包含在 iframe
中:
(为了安全起见,请在适当的地方使用 sandbox
attribute。)
因此,一个简单的博客文章页面的结构可以像这样:
<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:
关于广告的HTML元素?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14384431/