你可以使用<预置>元素在< section role =" main">元件? [英] Can you use an <aside> element inside a <section role="main"> element?
问题描述
我正在使用HTML5和WAI-ARIA改进HTML中的可访问性。
可以设置以下内容吗?
<! - 主要内容 - >
< section id =mainrole =main>
< h1>主要内容< / h1>
<! - 这个div需要在这里出于造型的原因 - >
< div class =the-content>
< p>主要内容的所有文字< / p>
< / div>
<! - 侧边栏 - >
< aside id =sidebarrole =complementary>
< h2>标题< / h2>
< p>一些文字< / p>
<预计>
< / section>
我不确定的是如果我应该有< ;在< code>< section>< / code>和
角色=main
>容器。这是否重要?
确实如此。放置位置由部分与
部分相关。
例如:
如果主要部分
内。但是,如果侧边栏旁边的标签
中的内容与 main
不同,我会将它放在<$ c $之外c>主要部分
http:// html5doctor .com / aside-revisited /
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside
I'm in the process of improving accessibility in my HTML using HTML5 and WAI-ARIA.
It is OK to have the following set up?
<!-- 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>
The thing I'm not sure of is if I should have the <aside>
element outside of the <section>
and the role="main"
container. Does that matter?
It does matter yes. Where to put it is defined by how the content in the aside
tag relates to the main section
.
For example:
If the content in the aside
is related to the main article, it should be inside the main section
. However if the content inside the sidebar aside tag
is different to main
I would put it outside of the main section
http://html5doctor.com/aside-revisited/
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside
这篇关于你可以使用<预置>元素在< section role =" main">元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!