锚不包含文本

  • 本文关键字:文本 包含 html
  • 更新时间 :
  • 英文 :

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

修复:在a元素或a元素的title属性中添加文本,或者,如果在锚中使用了图像,则在图像中添加Alt文本。

我需要做什么?

如果你想为图片添加Alt文本,你可以这样做

<img src="path" alt="your text">
  1. ">为a元素或a元素的title属性添加文本">

表示在<a>标签内添加文本,并为其添加title属性。当你想描述某件事时,就给元素起标题。当你添加title属性,如果将鼠标悬停在该元素上,将显示一个弹出窗口。

<a href="https://Google.com" title="If you click on this, it will direct you to google">
Google[hover]
</a>

  1. ">如果锚内使用了图像,则为该图像添加Alt文本。">

嗯,这意味着您必须在<a>标记内使用<img/>标记。并添加alt属性设置为图像。Alt对SEO很好,强烈推荐。当图像由于某种原因无法显示时,这里alt来寻求帮助并描述您的图像。

<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" />

注:这是一个提供随机图片的网站:Lorem Picsum.

最新更新