Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Multi-Element Content Labelling

Featured Replies

Hi Gang,

 

I'm working on a pet project and hit a snag with an accessible approach to my content. I have an icon (png) with one or two spans containing stars, so it looks something like this...

<span title="Name 2 or 3 Star">
   <img src="/images/icona.png" alt="">
   <span>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
   </span>
   <span>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
   </span>
</span>

I used spans as I want essentially a screen readers and search engines to read "Name 2 or 3 Star" as it will need to be essentially formula based layout so "Name 2 or 3 Star + Name 2 = Result". I've shown using title but then JAWS users often have titles turned off.

 

Any ideas?

 

Thanks

  • Author

I finally went for the Chris Coyier approach at https://css-tricks.com/html-for-icon-font-usage/. So ...

<span>
   <span class="screen-reader-text">Name 2 or 3 Star</span>
   <img src="/images/icona.png" alt="">
   <span>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
   </span>
   <span>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
       <i class="fa fa-star-o" aria-hidden="true"></i>
   </span>
</span>

... with ...

.screen-reader-text {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

... but if anyone else has a brighter idea let me know :D

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.