Home > OS >  Anchor contains no text
Anchor contains no text

Time:10-24

<a href="#sidewidgetarea" aria-label="Navigation Menu" aria-expanded="false" class="closed"> <span a ...

Repair: Add text to the a element or the title attribute of the a element or, if an image is used within the anchor, add Alt text to the image.

what i need to do ?

CodePudding user response:

if you want to put an Alt text to an img you can do this

<img src="path" alt="your text">

CodePudding user response:

  1. "Add text to the a element or the title attribute of the a element"

Here, means to add text inside <a> tag and to add title attribute to it. Titles are given to elements when you want to describe something. When you add title attribute, if you hover over the element, a pop up will be shown.

<a href="https://Google.com" title="If you click on this, it will direct you to google">
        Google[hover]
</a>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  1. "if an image is used within the anchor, add Alt text to the image."

Well, this means you must use a <img/> tag inside a <a> tag. And to add alt attribute to the image. Alt is good for SEO and highly recommended. When the image, for some reason, doesn't show, here alt comes for help and describes your image.

<img src="URL" alt="The image is not loaded, because I didn't add a source" />

<img src="https://picsum.photos/200/300" alt="You won't see alt now, because image will be shown" />
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

P.S. Here is a website that provides random image: Lorem Picsum.

  •  Tags:  
  • html
  • Related