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. K8S从入门到放弃系列-(12)Kubernetes集群Coredns部署

    摘要: 集群其他组件全部完成后我们应当部署集群 DNS 使 service 等能够正常解析,1.11版本coredns已经取代kube-dns成为集群默认dns. 1)下载yaml配置清单 [root ...

  2. Word 查找替换高级玩法系列之 -- 查找文档中的叠字

    叠字,顾名思义,就是重复出现,叠加在一起的文字,多多少少.点点滴滴等都属于这类范畴.而当Word文档中出现这类文字的时候我们应该怎么鉴别呢?如何找到这些叠字? 李清照的<声声慢>一词相信大 ...

  3. PAT甲级 模拟题_C++题解

    模拟题 PAT (Advanced Level) Practice 模拟题 目录 1008 Elevator (20) 1042 Shuffling Machine (20) 1046 Shortes ...

  4. python学习-50 pickle模块

    pickle模块 与json方法是一样的 import pickle dic = {'} print(type(dic)) a = pickle.dumps(dic) print(type(a)) f ...

  5. 区间第k大问题 权值线段树 hdu 5249

    先说下权值线段树的概念吧 权值平均树 就是指区间维护值为这个区间内点出现次数和的线段树 用这个加权线段树 解决第k大问题就很方便了 int query(int l,int r,int rt,int k ...

  6. 十大经典排序【Java实现,手工作坊式】

    终于把排序这个硬骨头,但是又很基础的知识点,自己手撕了一遍!之前,使用Python看着算法导论的书手撕过一遍,印象不是很深刻,容易忘记!好记性不如烂笔头!多自己思考解决问题 1,交换类CAS[最简单] ...

  7. pymsql及事务

    MySQL知识点补充 1.去重 distinct select distinct name,age from t1; # 针对查找出来的结果整行(记录)进行去重,也就是相同行只保存一个 注意点:dis ...

  8. CircularSlider半弧形滑动条

    前言 这边文章主要 是写 一.半圆弧型滑块的设计 最近项目中需要用到半圆弧形滑块,其作用和UISlider差不多,用于拖动改变播放音乐的播放进度. 大概样子是这样的: 效果展示 特点如下: 滑动响应区 ...

  9. 如何在Web应用里消费SAP Leonardo的机器学习API

    去年5月的时候,Jerry曾经写了一篇文章:使用Java程序消费SAP Leonardo的机器学习API,而最近另外做的一个项目,需要在Web应用里做同样的事情. 因为有了前一篇文章的铺垫,避免了很多 ...

  10. 【Distributed】分布式任务调度平台

    一.概述 什么是定时任务 二.Java实现定时任务方式 2.1 Thread 2.2 TimerTask 2.3 ScheduledExecutorService 2.4 Quartz 引入maven ...