我正在使用 HTML5 和 WAI-ARIA 改善我的 HTML 的可访问性。
以下设置是否正确?
<!-- main content -->
<section id="main" role="main">
<h1>The main content</h1>
<!-- This div needs to be here for styling reasons -->
<div class="the-content">
<p>All the text that goes with the main content</p>
</div>
<!-- the sidebar -->
<aside id="sidebar" role="complementary">
<h2>A title</h2>
<p>Some text</p>
<aside>
</section>
我不确定的是,是否应该将 <aside>
元素放在 <section>
和 role="main"
容器的外面。这样做有影响吗?
<aside>
元素放在<main>
元素内,而你所拥有的代码是一个位于父级<section>
内的<aside>
元素。 - Inigo