[HTML5] Add Semantic Styling to the Current Page of a Navigation Item with aria-current
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:
- Using the aria current attribute
- W3 WAI-ARIA - aria-current
- Breadcrumb Example - w3-WAI ARIA Practices
<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的更多相关文章
- 小程序报错Do not have xx handler in current page的解决方法
看到小程序这一大串的“Do not have bindName handler in current page: pages/card/card. Please make sure that bind ...
- Reporting Service 告警"w WARN: Thread pool pressure. Using current thread for a work item"
如果Reporting Service偶尔出现不可访问或访问出错情况,这种情况一般没有做监控的话,很难捕捉到.出现这种问题,最好检查Reporting Service的日志文件. 今天早上就遇到这样一 ...
- [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 ...
- [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 - ...
- (GoRails)链接link_to到当前页current Page 并使用参数 (类ActionController::Parameters)
https://gorails.com/episodes/rails-link-to-current-page-with-params?autoplay=1 如何链接到当前页并增加,移除,或者修改UR ...
- Do not have XXX handler in current page
这种错误没有什么技术含量,也很容易解决. 一般就是wxml里面的button/form之类的,你用bindtap/bindsubmit给它绑了一个XXX函数,但是呢,你没有在相关js页面里面定义这个函 ...
- 问题:HttpContext.Current.Session;结果:Session与HttpContext.Current.Session到底有什么区别呢?
我在做练习的时候遇到了这样一个问题,在母版页页面中写入登录和密码修改的js代码,在登录的方法中写 入 HttpContext.Current.Session.Add("UserPwd&quo ...
- Using the Security System 使用安全系统
In this lesson, you will learn how to use a Security System in the application. When you use this sy ...
- V-Play 文档翻译 Page
V-Play 文档翻译 Page 翻译:qyvlik 应用的一个页面. VPlayApps 1.0 Inherits: MouseArea Inherited By: ListPage 属性 Item ...
随机推荐
- 一个简单的一个sql表遍历
简单的一个sql表遍历 一般我们写储存过程或者其他sql语句的时候都会用到循环遍历数据,最常用的两种就是 1.游标 2.临时表+while 下面贴出示例代码 DECLARE @MinReLogID I ...
- linux下jar命令(运行jar包)
直接用java -jar xxx.jar,当退出或关闭shell时,程序就会停止掉. 普通方式启动应用: java -jar jarPackageName.jar 1>system.log ...
- C++:标准模板库vector
一:介绍 vector是C++标准模板库,是一个容器,底层是数组,为连续内存. 命名空间为std,所属头文件为<vector> 注意:不是<vector.h> vector ...
- C++中静态成员函数和普通成员函数存储方式相同
先从一个示例查看类的创建过程中,静态成员函数和普通成员函数的存储区别. #include "stdafx.h" #include<iostream> #include& ...
- msql 数据类型
1.数据类型 #1. 数字: 整型:tinyinit int bigint 小数: float :在位数比较短的情况下不精准 double :在位数比较长的情况下不精准 0.0000012301231 ...
- PAT(B) 1014 福尔摩斯的约会(Java)
题目链接:1014 福尔摩斯的约会 注意 三个字眼:"第1对","第2对","第1对",因此如果你用了循环,别忘了break,因为后面也可能 ...
- WUSTOJ 1247: 递增或递减排序(Java)
1247: 递增或递减排序 题目 有n个整数,求它的递增排序序列或递减排序序列.更多内容点击标题. 分析 统一升序排序,输出的时候做区分. 先区分是升序还是降序,调用库函数. 代码 方法1,将 ...
- 1204: 移位运算(C)
一.题目 http://acm.wust.edu.cn/problem.php?id=1204&soj=0 二.分析 无符号短整数关键字为:unsigned short: 无符号短整数长为2字 ...
- core项目打包时发现有的项目的xml文件不会被打包进去,怎么办?
我打包后发现打包后的文件夹内,不存在xml文件,所以swagger加载失败:然后经过测试发现Core项目打包的时候是默认不包含Xml文件的,VS里面也没有办法设置. 解决方法:手动修改项目文件,找到你 ...
- 关于__new__和__init__
关于__new__和__init__ 例如一个类 class Foo(object): def __init__(self): print(1) def __new__(self): print(2) ...