你可以使用<预置>元素在< section role =" main">元件? [英] Can you use an <aside> element inside a <section role="main"> element?

查看:308
本文介绍了你可以使用<预置>元素在< section role =" main">元件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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

这篇关于你可以使用&lt;预置&gt;元素在&lt; section role =&quot; main&quot;&gt;元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆