html – 你可以在元素中使用元素吗?

前端之家收集整理的这篇文章主要介绍了html – 你可以在元素中使用元素吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用HTML5和WAI-ARIA来改进HTML中的可访问性。

可以进行以下设置吗?

  1. <!-- main content -->
  2. <section id="main" role="main">
  3. <h1>The main content</h1>
  4.  
  5. <!-- This div needs to be here for styling reasons -->
  6. <div class="the-content">
  7. <p>All the text that goes with the main content</p>
  8. </div>
  9.  
  10. <!-- the sidebar -->
  11. <aside id="sidebar" role="complementary">
  12. <h2>A title</h2>
  13. <p>Some text</p>
  14. <aside>
  15. </section>

我不知道的是,如果我应该有< aside> < section>之外的元素和role =“main”容器。这很重要吗

解决方法

没关系是的。在哪里放置它是由aside标签中的内容与主要部分的关系来定义的。

例如:

如果内容与主要文章有关,则应在主要内容之内。但是,如果侧边栏旁边标签内容与主要不同,我将把它放在主要部分之外

http://html5doctor.com/aside-revisited/

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside

猜你在找的HTML相关文章