Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable sr-only span element using Font Awesome

Font Awesome is adding a hidden span element with the name of the icon in it.

Example:

<span class="sr-only">Camera</span>

How can I tell Font Awesome not to render this element (disable this feature). I am using the official Font Awesome script.

like image 720
Idan Shechter Avatar asked Sep 12 '25 12:09

Idan Shechter


1 Answers

If you want to set alternative text, Then you can use aria-hidden="true" attribute.

sr-only is for screen reader purpose. Don't remove it.

You can add custom CSS for change/disable sr-only property.

Here is an Example

.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip: rect(0,0,0,0);
   border: none;
}

You can get more details for Font Awesome sr-only class from Here

like image 123
Sumon Sarker Avatar answered Sep 14 '25 01:09

Sumon Sarker