我一直在阅读如何将HTML中的tabindex功能应用到元素的文档,我试图将它添加到我的HTML下面的“空btn”按钮,但Tab键功能直接传到我的社交媒体图标。为什么是这样?我该如何解决这个问题,以便它在图标之前标记按钮?Tabindex不工作?
HTML
<p class="designations">
<%= profile.designations %>
<button type="button" class="empty-btn" tabindex="0">
<div class="designations-popup">
<div class="popup-content">
<h5><%- theme_data.designation_pop_title %></h5>
<p><%- theme_data.designation_pop_msg %></p>
</div>
</div>
</button>
</p>
<% } %>
<h2 itemprop="jobTitle">
<%= theme_data.job_title.replace(/(®)/ig, "<sup>$1</sup>") %>
</h2>
</section>
<% if (profile.networks) { %>
<!-- Social Icons -->
<div class="hidden-sm hidden-xs pull-right social-icons">
<% if (profile.networks.facebook_url) { %>
<a href="<%- profile.networks.facebook_url %>" target="_blank">
<img alt="Facebook Logo" src="./images/facebook.png">
</a>
<% } %>
<% if (profile.networks.twitter_url) { %>
<a href="<%- profile.networks.twitter_url %>" target="_blank">
<img alt="Twitter Logo" src="./images/twitter.png">
</a>
<% } %>
<% if (profile.networks.linkedin_url) { %>
<a href="<%- profile.networks.linkedin_url %>" target="_blank">
<img alt="LinkedIn Logo" src="./images/linkedin.png">
</a>
<% } %>
</div>
<% } %>
请尝试使用易于阅读的方式来设置您的代码格式 –
您的社交媒体图标具有什么'tabindex'值? – Xufox
此外,'button'(https://developer.mozilla.org/en/docs/Web/HTML/Element/button)中只允许使用短语内容,您应该阅读:http://adrianroselli.com/ 2014/11/dont-use-tabindex-greater-than-0.html这将解释什么'tabindex =“0”'做的, –