对于图像,使用name元素有什么好处?NAME = "..."

Bra*_*rad 0 html

我想知道alt =""和name =""之间的区别是什么

将文件名放在alt标记或照片描述中会更好吗?

从SEO和验证角度来看,更有意义的是什么?

Aro*_*eel 5

ALT在搜索引擎优化方面,使用该属性更有用.使用NAME属性主要用于内部页面锚点.

ALT属性旨在提供替代文本,用于描述使用屏幕阅读器或搜索引擎的用户的图像.

name属性主要用于内部锚定,允许您使用锚点在页面内导航.

name属性的示例用法:

<!-- following ancor can be referenced as http://<your_url>#post-123 -->
<a name="post-123">permanent link to some post</a>
Run Code Online (Sandbox Code Playgroud)

alt属性的使用示例:

<!-- following image shows "FooBar Company Logo" when images can't be shown -->
<img src="logo.jpg" alt="FooBar Company logo" />
Run Code Online (Sandbox Code Playgroud)