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;
}
}
}

[HTML5] Add Semantic Styling to the Current Page of a Navigation Item with aria-current的更多相关文章

  1. 小程序报错Do not have xx handler in current page的解决方法

    看到小程序这一大串的“Do not have bindName handler in current page: pages/card/card. Please make sure that bind ...

  2. Reporting Service 告警"w WARN: Thread pool pressure. Using current thread for a work item"

    如果Reporting Service偶尔出现不可访问或访问出错情况,这种情况一般没有做监控的话,很难捕捉到.出现这种问题,最好检查Reporting Service的日志文件. 今天早上就遇到这样一 ...

  3. [ARIA] Add aria-expanded to add semantic value and styling

    In this lesson, we will be going over the attribute aria-expanded. Instead of using a class like .op ...

  4. [HTML5] Add an SVG Image to a Webpage and Get a Reference to the Internal Elements in JavaScript

    We want to show an SVG avatar of the patio11bot, so we'll do that in three ways: Using an img tag - ...

  5. (GoRails)链接link_to到当前页current Page 并使用参数 (类ActionController::Parameters)

    https://gorails.com/episodes/rails-link-to-current-page-with-params?autoplay=1 如何链接到当前页并增加,移除,或者修改UR ...

  6. Do not have XXX handler in current page

    这种错误没有什么技术含量,也很容易解决. 一般就是wxml里面的button/form之类的,你用bindtap/bindsubmit给它绑了一个XXX函数,但是呢,你没有在相关js页面里面定义这个函 ...

  7. 问题:HttpContext.Current.Session;结果:Session与HttpContext.Current.Session到底有什么区别呢?

    我在做练习的时候遇到了这样一个问题,在母版页页面中写入登录和密码修改的js代码,在登录的方法中写 入 HttpContext.Current.Session.Add("UserPwd&quo ...

  8. Using the Security System 使用安全系统

    In this lesson, you will learn how to use a Security System in the application. When you use this sy ...

  9. V-Play 文档翻译 Page

    V-Play 文档翻译 Page 翻译:qyvlik 应用的一个页面. VPlayApps 1.0 Inherits: MouseArea Inherited By: ListPage 属性 Item ...

随机推荐

  1. SQL数据库基础语法

    SQL语句的概述 SQL语言的分类 数据定义语言(Data Definition Language)主要用于修改.创建和删除数据库对象,其中包括CREATE  ALTER  DROP语句. 数据查询语 ...

  2. Erlang:[笔记二,构建工具rebar之发布应用]

    概述 通过rebar可以发布rebar构建的erlang项目,生成可执行的二进制脚本文件,大大降低了执行应用的复杂度.该笔记Erlang环境为Erlang/OTP 19 ,以下适用于Eralng/OT ...

  3. jquery绑定input的change事件

    ### jquery绑定input的change事件 背景:在做一个登录页时,如果用户未输入验证码则无法点击登录按钮,所以想到了用input的change事件,但是在写完后发现无法监听input值的改 ...

  4. SQL语句中加中括号[ ]的作用

    有些可能是SQL里面的保留字,但是你又用了它做字段名 比如Action,用[Action] 就可以避免这个问题,如果直接Action SQL就要报错了. 解决较长的中文名表名可能会被不识别的问题.

  5. SpringFramework5.0 @Indexed注解 简单解析

    目录 使用场景 使用方法 原理说明 使用需注意点 案例说明 参考资料 纸上得来终觉浅 绝知此事要躬行 -陆游 最近在看SpringBoot核编程思想(核心篇),看到走向注解驱动编程这章,里面有讲解到: ...

  6. SQL 不同服务器数据库操作

    https://www.cnblogs.com/lusunqing/p/3660190.html --创建远程链接服务器 execute sys.sp_addlinkedserver @server= ...

  7. vue中子组件的created、mounted钩子中获取不到props中的值问题

    父子组件通信 这个官网很清楚,也很简单,父组件中使用v-bind绑定传送,子组件使用props接收即可 例如: 父组件中: <template> <div> <head- ...

  8. 经典SQL数据库面试题以及答案—Oracle版本-SQL全部在plsql开发编写-欢迎提问

    Student(Sno,Sname,Sage,Ssex) 学生表 S1:学号:Sname:学生姓名:Sage:学生年龄:Ssex:学生性别 Course(Cno,Cname,T1) 课程表 C1,课程 ...

  9. springboot2.0介绍1

    SpringBoot 一. Spring介绍 1.1.SpringBoot简介 在您第1次接触和学习Spring框架的时候,是否因为其繁杂的配置而退却了?在你第n次使用Spring框架的时候,是否觉得 ...

  10. iOS 超级签名详解

    一.原理 把安装设备当做开发设备进行分发.说的明白一些,开发者可以在开发者后台添加手机的UDID,然后重新打包一个IPA文件,分发平台,然后被添加的UDID就可以下载. 二.优缺点 优势: 直接分发, ...