Anchor contains no text - html

<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 ?

if you want to put an Alt text to an img you can do this
<img src="path" alt="your text">

"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>
"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" />
P.S. Here is a website that provides random image: Lorem Picsum.

Related

How to use ALT tag correctly?

I have used the ALT tags for all my images with this format:
<a alt="IMAGE ALT TEXT" href="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s1600/jquery-lightbox-with-dark-background.png" imageanchor="1"><img src="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s320/jquery-lightbox-with-dark-background.png" style="height:100%; width:100%;" /></a>
But I was surprised when the image checker tools sensed their alt tags as "missing". I supposed I had to insert the "alt" tag after the "img src" tag like that:
<img src="http://2.bp.blogspot.com/-MEHRDQvoG-c/Ux0mL1mlJII/AAAAAAAAGg8/S9h3KjhJ6YQ/s320/jquery-lightbox-with-dark-background.png" alt="IMAGE ALT TEXT" style="height:100%; width:100%;" />
Tell me please will this style correct?
alt is a property of IMG tag and not of A tag. It stands for alternative text to be shown or read by screen readers. So the second example you provided is the right one.
The alt attribute must be on the element and not on the hyperlink element.
You may be confusing the "alt" tag and the "title" tag.
The "alt" tag is used with images:
<img src="someImage.jpg" alt="image">
The title tag can be used with BOTH images and links
<img src="someImage.jpg alt="image" title="Some Image">
<a href="someLink.com" title="This is some link">
There wouldn't be any need for an "alt" tag on a traditional link, because even if the link was bad, there would still be text wrapped in the anchor indicating what it is:
Link to some link
With the image, the "alt" property value only displays when the image, for whatever reason, isn't available.
the alt should be only used in <applet>, <area>, <img>, <input>
alt - <applet>, <area>, <img>, <input> - Alternative text in case an
image can't be displayed.
Source
here is a snippet of img:
<img src="http://lorempixel.com/100/100" alt="image">

What does the alt tag mean in HTML

I am just learning HTML. I have a confusion on using image and alt in learning HTML. When I use alt it doesn't go to the alt image.
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
When I try to use my own example, or image, it doesn't work.
The alt attribute specifies an alternate text for the image, if it cannot be displayed.
The alt attribute is required in HTML4 and the page will not be valid without it.
Checkout at this link an example: example.
<img src="http://www.1341234123412312/ic_mountain.jpg" alt="Image not found" style="width:200px;height:128px"/>
alt isn't a tag, it's an attribute. It doesn't specify an alternate image, it defines the alternate text of an image if it cannot be displayed. In most cases it's used as hover-over text.
Like henriquedsg89 mentioned the alt ATTRIBUTE is used to display alternate text. An example of it's purpose would be if a blind person can't see the photos. Instead the browser will read the alt attribute out loud.
alt is attribute, and used to display the image description. if image is not displayed because of some case.
<img src="/img.jpg" alt="Image not found">

Image title attribute or anchor title attribute or both?

Let's say I have a list of images on the page, that are wrapped within links. So when u click an image it gets you to a page that displays the larger image
How should I handle title tags here?
Do I put the image title on both the image and the link, or just the image? Does it matter if the title is the same as the "alt" attribute?
<a title="image description" href="#"><img title="image description" alt="image description" src="image.jpg"></a>
HTML5 defines guidelines for alt usage. See the section "A link or button containing nothing but an image":
When an a element that is a hyperlink, or a button element, has no text content but contains one or more images, include text in the alt attribute(s) that together convey the purpose of the link or button.
So your alt attribute content could include something like "Open larger version of …".
(You may also be interested in my answer to the question on UX SE: What should the ALT text be for an image that is also a link?)
You should never have the same content for alt and title. See the general guidelines (from the W3C Candidate Recommendation of HTML5) (Update: In the W3C Recommendation of HTML5, this section got changed, and it no longer contains that quote.):
A corollary to this is that the alt attribute's value should never contain text that could be considered the image's caption, title, or legend. It is supposed to contain replacement text that could be used by users instead of the image; it is not meant to supplement the image. The title attribute can be used for supplemental information.
The image title attribute should describe the image.
The link title attribute should describe the target of the link.
<a title="view larger version" href="#">
<img title="image description" alt="image description" src="image.jpg">
</a>

Display message only in Lynx?

I have an image with text in it on a website. Is there a way to show the plain text in place of the image if images are disabled (including Lynx)?
Use alt argument of img tag
<img src="url" alt="alternate text"/>
Use the alt attribute and put the text in there.

How do I solve this issue in IE7?

When I am testing my page in IE7, all the image have a tooltip corresponding to the text of the alt in the image tag..
<img src="Myimage.jpg" alt="No pic" />
When I hover my mouse on the displayed pic in IE7, I get a tooltip "No pic" corresponding to the text of the alt .How do I fix this ?
IE6/7 treats the alt attribute as though it was a title attribute - but only if there's no actual title attribute set.
You can workaround it with a blank title:
<img src="Myimage.jpg" alt="No pic" title="" />
You can try adding an empty title tag
<img src="image.jpg" alt="nopic" title="" />
The answer has been posted already (empty title tag).
However, (in reference to one of the answers) alts are supposed to describe the image for 508 compliance reasons and if the image doesn't show up, so you should change the alt text to describe your picture.
I would have made a comment on the original post but SO doesn't allow me to yet.
The actual question here is why are you using alt the way you are? If your image is simply decorative, you should have an empty alt attribute. look at the W3CS definition of the alt attribute.
http://www.w3.org/QA/Tips/altAttribute
On this occasion is suspect youd actually want:
<img src="Myimage.jpg" alt="" />