0

I am using an <i> tag to display social media icons and links. However, WCAG calls for having text or an img with alt attribute for compliancy.

I'd like to know if putting a title attribute on the <i> tag will be compliant:

<i class="this-is-the-icon" title="Icon Title"></i>

If not, what is a workaround to make sure that these hrefs are compliant?

unor
  • 92,415
  • 26
  • 211
  • 360
Yung P
  • 1

1 Answers1

0

Use screen reader only text. This will be invisible to sighted users, but screen readers will still read it out.

<i class="this-is-the-icon"><span class="screen-reader-only">Icon 
Title</span></i>

.screen-reader-only {
  position:absolute;
  left:-10000px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}

This is the approach advocated by WebAim [https://webaim.org/techniques/css/invisiblecontent ]