链接访问后刷新颜色回到初始_如何使链接可访问(提示:颜色不够)

链接访问后刷新颜色回到初始

Link accessibility is one of the most important aspects of usability. However, designers often don't understand what it takes to make links accessible. Most frequently, they only distinguish links by color, which makes it hard for users with visual disabilities to spot them in text blocks — even if high color contrast is used.

链接可访问性是可用性的最重要方面之一。 但是,设计人员通常不了解使链接可访问所需的时间。 大多数情况下,它们仅按颜色区分链接,即使使用高色差,视觉障碍的用户也很难在文本块中发现它们。

As a rule of thumb, accessible links shouldn't rely solely on colors. Partly because users with low vision, color deficiency, and other visual  impairments can't always recognize this kind of link, but also because  it's easier for regular users to skim through the content if links are better emphasized.

根据经验,可访问的链接不应仅依赖颜色。 部分原因是视力低下,色彩不足和其他视觉障碍的用户不能始终识别这种链接,还因为如果更好地强调链接,普通用户更容易浏览内容。

However, it's not always easy to find out how to create accessible links that match your website design. It's also possible to overdo it by using too many visual signifiers that might confuse the  user.

但是,找出如何创建与您的网站设计相匹配的可访问链接并不总是那么容易。 也可能通过使用太多可能使用户感到困惑的视觉指示符来过度使用它。

链接类型 (Link types)

When we speak about links, we usually think of the classic blue links with an underline, however there are actually different kinds of links,  such as:

当我们谈论链接时,通常会想到带下划线的经典蓝色链接,但是实际上存在不同种类的链接,例如:

  • body text links,

    正文文本链接,
  • headline and subtitle links,

    标题和字幕链接,
  • menu links,

    菜单链接
  • buttons,

    纽扣,
  • image links,

    图片链接,
  • video links,

    视频链接
  • audio links,

    音频链接
  • and more.

    和更多。

In this article, I'll only speak about the first group: body text links. Don't read it as a guideline but rather an experiment for understanding  what can be done for more accessible links.

在本文中,我仅讨论第一组:正文文本链接。 不要将其作为指导来阅读,而应该做一个实验,以了解可以为更易访问的链接做什么。

根据WCAG 2.0的可访问链接 (Accessible links according to WCAG 2.0)

According to WebAIM's guidelines about links and hypertext, WCAG 2.0 has two additional requirements for body text links:

根据WebAIM关于链接和超文本的指南 ,WCAG 2.0对正文链接有两个附加要求:

  1. The link text must have a 3:1 contrast ratio from the surrounding non-link text.

    链接文本与周围的非链接文本的对比度必须为3:1。
  2. The link must present a "non-color designator" (typically the  introduction of the underline) on both mouse hover and keyboard focus.

    该链接必须在鼠标悬停和键盘焦点上都显示一个“非颜色指示符”(通常带有下划线)。

Web browsers come with a default link styling that meets these  requirements. You can check it out by disabling all additional CSS  styles using the Web Developer browser add-on or another dev tool. For example, this is how the  homepage of the Mozilla Developer Network looks like in Chrome:

Web浏览器带有符合这些要求的默认链接样式。 您可以使用Web Developer浏览器加载项或其他开发工具来禁用所有其他CSS样式,以进行检查。 例如,Mozilla开发人员网络的主页在Chrome中是这样的:

It's a very basic styling for sure, but it's still styling: the  underlined blue links are well-known and internet users can easily  recognize them. It's not a coincidence that the Nielsen-Norman Group  also names blue the safest link color choice in its Beyond Blue Links: Making Clickable Elements Recognizable article.

当然,这是一个非常基本的样式,但仍然是样式:带下划线的蓝色链接是众所周知的,互联网用户可以轻松识别它们。 尼尔森·诺曼集团(Nielsen-Norman Group)在其“ 超越蓝色链接:使可点击的元素变得可识别”一文中也将蓝色命名为最安全的链接颜色选择并非偶然。

无障碍链接示例 (Examples of accessible links)

WebAIM doesn't recommend removing the underline using CSS, as "users are accustomed to see links underlined". Still, many of the biggest  websites don't follow this principle of link accessibility. Many times,  they don't only remove the underline from the default link state but also the :hover styles.

WebAIM不建议使用CSS删除下划线,因为“​​用户习惯于看到带有下划线的链接”。 尽管如此,许多大型网站仍未遵循链接可访问性这一原则。 很多时候,它们不仅会从默认链接状态中删除下划线,而且还会删除:hover样式。

But, why do they do that? Mainly for aesthetical reasons, however  underlined links don't necessarily have to be plain-looking and boring.

但是,为什么要这样做呢? 主要是出于美学原因,但是带有下划线的链接不一定必须看起来很无聊。

1.边框底 (1. Border-bottom)

For instance, Bloomberg uses the border-bottom property to  mimic an underline in a different color. As you can see below, the link  texts are black while the underlines are blue, which gives a stylish  design to the links.

例如,彭博社使用border-bottom属性模仿其他颜色的下划线。 如下所示,链接文本为黑色,而下划线为蓝色,这为链接提供了时尚的设计。

Perhaps Bloomberg's links could further benefit from bold letters, but  it's a good example that underlines can be used for links creatively, not  just in the usual way.

彭博社的链接也许可以进一步从粗体字母中受益,但这是一个很好的例子,下划线可以创造性地用于链接,而不仅仅是通常的方式。

2.下划线 (2. Reverse underline)

The Verge uses a different approach to create underlines for body text  links. Here, underlines are present by default, however they are removed  when the user hovers over the link. When the underline disappears, the  color also changes subtlely, from pink to magenta (however this color  change is barely recognizable).

边缘使用另一种方法来创建正文文本链接的下划线。 此处,默认情况下显示下划线,但是当用户将鼠标悬停在链接上时,下划线将被删除。 当下划线消失时,颜色也会从粉红色变为洋红色(但是几乎无法识别)。

The presence of underlines in the default state helps readers easily  notice the links, even within large text blocks. And, when they hover  over the link, the state change is instantly visualized by the  disappearing underline. An unusual choice, for sure, but it still  follows the principle of using non-color designators for accessible  links.

默认状态下带有下划线的内容可以帮助读者轻松注意到链接,即使在较大的文本块中也是如此。 而且,当他们将鼠标悬停在链接上时,消失的下划线会立即显示状态变化。 当然,这是一个不寻常的选择,但它仍然遵循为访问链接使用非颜色指示符的原则。

3.图标 (3. Icons)

You can also help users recognize links by adding tiny icons next to  them. For example, some news sites add a video icon next to the links  that point to videos (however, embedding videos is a more widely used  practice these days).

您还可以通过在链接旁边添加小图标来帮助用户识别链接。 例如,某些新闻网站在指向视频的链接旁边添加了一个视频图标(但是,如今,嵌入视频是一种更为普遍的做法)。

WebAIM chose an all-inclusive solution for link accessibility. Besides  the underline, they also add a small icon after each external link. In  this way, the icon doesn't only serve as an extra visual signifier but  also clearly distinguishes external and internal links.

WebAIM选择了全方位的解决方案以实现链接访问。 除了下划线,它们还在每个外部链接之后添加一个小图标。 这样,该图标不仅可以充当额外的视觉指示符,还可以清楚地区分外部和内部链接。

You don't necessarily need to create a link icon by yourself. For instance, Font Awesome has an external link icon that you can quickly add to your links.

您不一定需要自己创建链接图标。 例如,Font Awesome有一个外部链接图标 ,您可以快速将其添加到链接中。

4.链接文字 (4. Link text)

As screen readers notify users when they come across a link, it's not  recommended to use phrases such as "link to" or "follow this link" for the link text. Instead, you should provide link texts that describe the main content of the link. It makes it easier for users to decide if they  want to click the link, which is especially important for users with cognitive disabilities.

由于屏幕阅读器会在用户遇到链接时通知用户,因此不建议在链接文本中使用诸如“链接到”或“跟随此链接”之类的短语。 相反,您应该提供描述链接主要内容的链接文本。 它使用户可以更轻松地决定是否要单击链接,这对于认知障碍用户尤其重要。

WCAG 2.0 even has a recommendation on how to provide proper link texts, with a handful of useful examples (mainly for image links, though).

WCAG 2.0甚至对如何提供正确的链接文本提出了建议,并提供了一些有用的示例(尽管主要用于图像链接)。

If you want to see an example of proper link text I would mention the  Gov.uk website that publishes governmental information in the UK. For  example, check out their Set up a business page.

如果您想查看适当的链接文本的示例,我会提到Gov.uk网站,该网站在英国发布了政府信息。 例如,请查看他们的“ 设置公司”页面。

Have a look at, for instance, the Find out more about being a sole trader and how to register line on the screenshot above. Note that they put the anchor tag on the  part that describes the purpose of the link ("being a sole trader and  how to register") instead of the action verb ("find out more").

例如, 查看一下有关如何成为独家商人的更多信息,以及如何在上面的屏幕截图中注册行。 请注意,他们将锚标记放在描述链接目的的部分(“成为唯一交易者以及如何注册”)上,而不是动作动词(“查找更多”)上。

title属性的争议角色 (The controversial role of the title attribute)

The role of the title global attribute in link accessibility is an interesting question. If you add it to a link, the extra information appears somewhere around the link when users hover it.

title全局属性在链接可访问性中的作用是一个有趣的问题。 如果将其添加到链接中,则当用户将其悬停时,多余的信息将显示在链接周围的某处。

For instance, take the following line of HTML:

例如,采用以下HTML行:

<a href="#" title="Extra information">Hover this link but don't click it.</a>

<a href="#" title="Extra information">Hover this link but don't click it.</a>

It's displayed like this in the browser: Hover this link but don't click it.

它在浏览器中显示为: 悬停此链接,但不要单击它。

I've long thought that adding the title attribute to links  is a good practice for accessibility, as the extra information helps  users understand the purpose of the link.  However, WCAG 2.0 has a  slightly different view on the question.

我长期以来一直认为,将title属性添加到链接中是一种可访问性的好习惯,因为额外的信息可帮助用户理解链接的目的。 但是,WCAG 2.0在此问题上的看法略有不同。

On their "Supplementing link text with the title attribute" page, they mention several accessibility problems. For example, the title attribute isn't available to assistive technology and keyboard-only  users. Besides, it disappears after about five seconds in some user  agents, which usually doesn't leave enough time to read it.

在他们的“ 用title属性补充链接文本 ”页面上,他们提到了一些可访问性问题。 例如, title属性不适用于辅助技术和仅键盘用户。 此外,在某些用户代理中大约五秒钟后它消失了,这通常没有足够的时间来读取它。

On the whole, WCAG 2.0 doesn't advise against the title attribute but recommends careful usage. One thing is sure, never use title for important information that is not available in another form, such as warnings. On another note, if title can be used only for unimportant information, is it worth using at all?

总体而言,WCAG 2.0不建议使用title属性,但建议谨慎使用。 可以肯定的是,切勿对其他信息无法使用的重要信息(例如警告)使用title 。 另一方面,如果title仅可用于不重要的信息,那么是否值得使用?

链接状态 (Link states)

There are five different link states, represented by CSS pseudo-classes: :hover, :focus, :active, :visited, and :link.

有五种不同的链接状态,由CSS伪类表示:hover:focus:active:visited:link

It's an open question whether it's better for accessibility to style all  link states differently or not. If you use different style rules for  each state, users are notified about every change indeed, however is  that always a good thing? Too many state changes can cause information  overload and confusion to the user.

这是一个悬而未决的问题,对于以其他方式设置所有链接状态的可访问性是否更好。 如果对每个状态使用不同的样式规则,则确实会向用户通知有关每个更改的信息,但这总是一件好事吗? 状态更改太多会导致信息过载和用户混乱。

Personally, I tend to create one style for the default link state, a second one for the :hover, :active, and :focus states, and sometimes a third one for :visited links. However, I still can't tell if this is the best solution for  accessibility. If you are interested in the topic here's an interesting StackOverflow UX discussion on whether the styling of the :focus and :hover states should be the same or distinct.

就个人而言,我倾向于为默认的链接状态创建一种样式,为:hover:active:focus状态创建第二种样式,有时为:visited链接创建第三种样式。 但是,我仍然无法确定这是否是可访问性的最佳解决方案。 如果您对该主题感兴趣,这里是一个有趣的StackOverflow UX讨论 ,内容是:focus:hover状态的样式应该相同还是不同。

However, there's an important thing you should keep in mind by all means. Don't remove the dotted outline that browsers use for the :focus state. Keyboard (tab) navigation will be useless if the focused element is not visible on the screen. If you remove the dotted outline, keyboard users will literally lose focus. If you're annoyed by the default outline style make it less obtrusive with extra styling, but don't remove it.

但是,您必须牢记一件重要的事情。 不要删除浏览器用于:focus状态的虚线轮廓。 如果焦点元素在屏幕上不可见,则键盘(选项卡)导航将无用。 如果删除虚线轮廓,键盘用户将失去焦点。 如果您对默认的轮廓样式感到厌烦,请使用额外的样式使其不那么引人注目 ,但请不要将其删除。

(Read more)

In my blog, I cover accessibility-related topics that are less widely discussed. If you want to read more, check out my article about why software documentation is part of accessibility, too.

在我的博客中,我讨论了与可访问性相关的主题,这些主题讨论得很少。 如果您想了解更多信息,请查阅我的文章,该文章也解释了为什么软件文档也是可访问性的一部分 。

翻译自: https://www.freecodecamp.org/news/link-accessibility-colors-are-not-enough/

链接访问后刷新颜色回到初始

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391260.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

567

567 转载于:https://www.cnblogs.com/Forever77/p/11519678.html

leetcode 403. 青蛙过河(dp)

一只青蛙想要过河。 假定河流被等分为若干个单元格&#xff0c;并且在每一个单元格内都有可能放有一块石子&#xff08;也有可能没有&#xff09;。 青蛙可以跳上石子&#xff0c;但是不可以跳入水中。 给你石子的位置列表 stones&#xff08;用单元格序号 升序 表示&#xff…

static、volatile、synchronize

原子性&#xff08;排他性&#xff09;&#xff1a;不论是多核还是单核&#xff0c;具有原子性的量&#xff0c;同一时刻只能有一个线程来对它进行操作&#xff01;可见性&#xff1a;多个线程对同一份数据操作&#xff0c;thread1改变了某个变量的值&#xff0c;要保证thread2…

tensorflow基本教程

转载自 http://tensornews.cn/ 转载于:https://www.cnblogs.com/Chris-01/p/11523316.html

1.10-linux三剑客之sed命令详解及用法

内容:1.sed命令介绍2.语法格式,常用功能查询 增加 替换 批量修改文件名第1章 sed是什么字符流编辑器 Stream Editor第2章 sed功能与版本处理出文本文件,日志,配置文件等增加,删除,修改,查询sed --versionsed -i 修改文件内容第3章 语法格式3.1 语法格式sed [选项] [sed指令…

python pca主成分_超越“经典” PCA:功能主成分分析(FPCA)应用于使用Python的时间序列...

python pca主成分FPCA is traditionally implemented with R but the “FDASRSF” package from J. Derek Tucker will achieve similar (and even greater) results in Python.FPCA传统上是使用R实现的&#xff0c;但是J. Derek Tucker的“ FDASRSF ”软件包将在Python中获得相…

blender视图缩放_如何使用主视图类型缩放Elm视图

blender视图缩放A concept to help Elm Views scale as applications grow larger and more complicated.当应用程序变得更大和更复杂时&#xff0c;可帮助Elm Views扩展的概念。 In Elm, there are a lot of great ways to scale the Model, and update, but there is more c…

初探Golang(2)-常量和命名规范

1 命名规范 1.1 Go是一门区分大小写的语言。 命名规则涉及变量、常量、全局函数、结构、接口、方法等的命名。 Go语言从语法层面进行了以下限定&#xff1a;任何需要对外暴露的名字必须以大写字母开头&#xff0c;不需要对外暴露的则应该以小写字母开头。 当命名&#xff08…

789

789 转载于:https://www.cnblogs.com/Forever77/p/11524161.html

sql的split()函数

ALTER function [dbo].[StrToList_Test](Str varchar(max), fg NVARCHAR(200)) returns table table(value nvarchar(max) ) as begindeclare tempStr nvarchar(max),len INT LEN(fg); --去除前后分割符 while substring(Str,1,len)fg beginset Strsubstring(Str,len1,len(S…

大数据平台构建_如何像产品一样构建数据平台

大数据平台构建重点 (Top highlight)Over the past few years, many companies have embraced data platforms as an effective way to aggregate, handle, and utilize data at scale. Despite the data platform’s rising popularity, however, little literature exists on…

初探Golang(3)-数据类型

Go语言拥有两大数据类型&#xff0c;基本数据类型和复合数据类型。 1. 数值类型 ##有符号整数 int8&#xff08;-128 -> 127&#xff09; int16&#xff08;-32768 -> 32767&#xff09; int32&#xff08;-2,147,483,648 -> 2,147,483,647&#xff09; int64&#x…

freecodecamp_freeCodeCamp的服务器到底发生了什么?

freecodecampUpdate at 17:00 California time: We have now fixed most of the problems. Were still working on a few known issues, but /learn is now fully operational.加利福尼亚时间17:00更新 &#xff1a;我们现在解决了大多数问题。 我们仍在处理一些已知问题&#…

为什么Linux下的环境变量要用大写而不是小写

境变量的名称通常用大写字母来定义。实际上用小写字母来定义环境变量也不会报错&#xff0c;只是习惯上都是用大写字母来表示的。 首先说明一下&#xff0c;在Windows下是不区分大小写的&#xff0c;所以在Windows下怎么写都能获取到值。 而Linux下不同&#xff0c;区分大小写&…

python:连接Oracle数据库后控制台打印中文为??

打印查询结果&#xff0c;中文显示为了&#xff1f;&#xff1f;&#xff1f; [(72H FCR, 2.0), (?????, 8.0)] E:\Python35\Lib\site-packages中新增文件&#xff1a; sitecustomize.py import os os.environ[NLS_LANG] SIMPLIFIED CHINESE_CHINA.UTF8 转载于:https://w…

时间序列预测 时间因果建模_时间序列建模以预测投资基金的回报

时间序列预测 时间因果建模Time series analysis, discussed ARIMA, auto ARIMA, auto correlation (ACF), partial auto correlation (PACF), stationarity and differencing.时间序列分析&#xff0c;讨论了ARIMA&#xff0c;自动ARIMA&#xff0c;自动相关(ACF)&#xff0c;…

初探Golang(4)-map和流程控制语句

1.map map 是引用类型的&#xff0c;如果声明没有初始化值&#xff0c;默认是nil。空的切片是可以直接使用的&#xff0c;因为他有对应的底层数组,空的map不能直接使用。需要先make之后才能使用。 //1, 声明map 默认值是nil var m1 map[key_data_type]value_data_type 声明 …

网络传输之TCP/IP协议族

我们现实网络无处不在&#xff0c;我们被庞大的虚拟网络包围&#xff0c;但我们却对它是怎样把我们的信息传递并实现通信的&#xff0c;我们并没有了解过&#xff0c;那么当我们在浏览器中出入一段地址&#xff0c;按下回车这背后都会发生什么&#xff1f; 比如说一般场景下&am…

(58)PHP开发

LAMP0、使用include和require命令来包含外部PHP文件。使用include_once命令&#xff0c;但是include和include_once命令相比的不足就是这两个命令并不关心请求的文件是否实际存在&#xff0c;如果不存在&#xff0c;PHP解释器就会直接忽略这个命令并且显示一个错误消息&#xf…

css flexbox模型_如何将Flexbox后备添加到CSS网格

css flexbox模型I shared how to build a calendar with CSS Grid in the previous article. Today, I want to share how to build a Flexbox fallback for the same calendar. 在上一篇文章中&#xff0c;我分享了如何使用CSS Grid构建日历。 今天&#xff0c;我想分享如何为…