如何修复HTML验证警告:<a> proprietary attribute &#39;role&#39; or &#39;aria-expanded&#39;

时间:2016-03-14 06:53:50

标签: html

I am validating my HTML website built on bootstrap and got following warning. My question is that how should i fix this issue. Note: i have fixed more than 67 warnings but unable to fix these warnings. One thing i have searched lot on google but not found any post to fix this issue. Lastly, i have only one option i.e to ask here. Please help me

line 87 column 75 - Warning: proprietary attribute 'aria-expanded'
line 99 column 83 - Warning: proprietary attribute 'role'
line 99 column 83 - Warning: proprietary attribute 'aria-haspopup'
line 99 column 83 - Warning: proprietary attribute 'aria-expanded'
line 111 column 83 - Warning: proprietary attribute 'role'
line 111 column 83 - Warning: proprietary attribute 'aria-haspopup'
line 111 column 83 - Warning: proprietary attribute 'aria-expanded'
line 123 column 89 - Warning: proprietary attribute 'role'

Warning Screen Shot:

*以下是仅包含导航部分的新代码,以下是警告*

<nav class="navbar navbar-default  header-top-menu" id="top-navigation-menu">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar">&nbsp;</span>
<span class="icon-bar">&nbsp;</span>
<span class="icon-bar">&nbsp;</span>
</button>                                     
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Home<span class="caret">&nbsp;</span></a>
<ul class="dropdown-menu dropdown-menu-custom">
<li><a href="#" >Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Pages<span class="caret">&nbsp;</span></a>
<ul class="dropdown-menu dropdown-menu-custom">
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</li>
<!--multi level menu -->
<li class="dropdown" >
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" > Portfolio <b class="caret">&nbsp; </b></a>
<ul class="dropdown-menu multi-level dropdown-menu-custom">
    <li class="dropdown-submenu ">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Grid Layout</a>
        <ul class="dropdown-menu1">
            <li><a href="#">2 Columns </a></li>
            <li><a href="#">3 Columns</a></li>
            <li><a href="#">4 Columns</a></li>
        </ul>
    </li>
    <li class="dropdown-submenu">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Mansonry Layout</a>
        <ul class="dropdown-menu1">
            <li><a href="#">Link</a></li>
            <li><a href="#">Link</a></li>
            <li><a href="#">Link</a></li>
        </ul>
    </li>
    <li><a href="#">Portfolio Item Page</a></li>
</ul>
</li>
<!--/multi level menu -->


<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>                                     
</div><!-- /.navbar-collapse -->                                 
</nav>

=============================================== =======================

这是我收到的警告

  

第4行第75列 - 警告:专有属性      “咏叹调扩展”
    第16行第83栏 - 警告:专有属性'角色'
    第16行第83栏 - 警告:专有属性      '咏叹调-haspopup'
    第16行第83栏 - 警告:专有属性      “咏叹调扩展”
    第28行第83栏 - 警告:专有属性'角色'
    第28行第83栏 - 警告:专有属性      '咏叹调-haspopup'
    第28行第83栏 - 警告:专有属性      “咏叹调扩展”
    第40行第89栏 - 警告:专有属性'角色'

1 个答案:

答案 0 :(得分:0)

您使用的是哪种doctype? HTML 4.01或HTML5?我怀疑它是HTML 4.01,所以我建议您使用:<DOCTYPE html>而不是