1

Ho to add alt attribute for the React coreUI CAvatar img?

We have the below code to display the image as an avatar in our application, but while doing the web accessibility test we get a Missing alternative text error for this image.

<CAvatar style={{backgroundColor:"#71c6a2"}} src='/assets/img/avatars/power.jpg' size="lg" />

So I tried to add alt text like below <CAvatar style={{backgroundColor:"#71c6a2"}} src='/assets/img/avatars/power.jpg' size="lg" alt="power" /> but the alt text is applied for the outside div of the avatar. How to add alt text for img attribute when using CAvatar? here is the generated HTML for ref: <div class="avatar avatar-lg" alt="Yet-to-Start" style="background-color: rgb(113, 198, 162);"><img src="/assets/img/avatars/power.jpg" class="avatar-img"></div>

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.