In this lesson, we are going to use aria-current to give a screen reader user more context about what the current page is. Historically, many developers use an .active class to indicate that the page in a menu is the same that you're on.

Instead of using a class, we are going to use the aria-current attribute to add more semantic value to the HTML and use that attribute to style the active link.

Note: VoiceOver testing works best on the Native Safari Browser, hence why we should always use Safari to test.

More resources:

<nav>
<ul class="menu">
<li class="menu__item">
<a href="/" class="menu__link" aria-current="page">Home</a>
</li>
<li class="menu__item">
<a href="/" class="menu__link">About</a>
</li>
<li class="menu__item">
<a href="/" class="menu__link">News</a>
</li>
<li class="menu__item">
<a href="/" class="menu__link">Contact</a>
</li>
</ul>
</nav>
.menu {
display: flex;
padding:;
list-style: none; .menu__link {
display: inline-block;
position: relative;
text-transform: uppercase;
font-weight: bold;
color: #6505cc;
padding: 0.675rem;
margin: 0 0.5rem;
font-size: 1.5rem;
text-decoration: none; &[aria-current="page"] {
border-bottom: 8px solid #6505cc;
}
}
}

最新文章

  1. [LeetCode] Power of Three 判断3的次方数
  2. 微信小程序产品定位及功能介绍
  3. 避免在ASP.NET Core中使用服务定位器模式
  4. iOS中Objective-C与JavaScript之间相互调用的实现(实现了与Android相同的机制)转
  5. 1029c语言文法定义与c程序的推导过程
  6. C# 给数据库传入当前时间
  7. Zigzag Iterator 解答
  8. 【Android基础】Activity之间进行参数传递的三种方式
  9. asp.net webForm 前后台类关系
  10. 【原创】Superset在windows下的安装配置
  11. mac mono Fiddler.exe启动失败
  12. 如何用Visio画venn(维恩)图
  13. Java中三种代理模式
  14. BZOJ4241历史研究——回滚莫队
  15. &lt;六&gt;企业级开源仓库nexus3实战应用–使用nexus3配置yum私有仓库
  16. 我所理解Java集合框架的部分的使用(Collection和Map)
  17. Lepus监控之Oracle配置
  18. Android NDK之二:创建NativeActivity
  19. Elasticsearch工作原理
  20. Buffer I/O error on device sr0

热门文章

  1. SQLite之rowid与sqlite3_last_insert_rowid()
  2. 用Python获取计算机网卡信息
  3. Centos 修改IP地址、网关、DNS
  4. go if 便捷语句
  5. Unity插件研究-EasyTouch V5
  6. android 和 js 交互
  7. Eclipse syntax coloring java xml 语法 样式
  8. cli create ssl certkey
  9. ztree在onCheck()方法中防止因触发联动关系导致页面多次渲染而卡死的问题
  10. vue使用layer主动关闭弹窗