关于标题/ Alt属性; [英] About the Title/Alt attributes;
问题描述
我希望我可以发表这一点。
我理解title和alt属性的用途,但我不明白它们的最佳用途,或者if我可以多次使用相同的标题/替换项。
例如一个关于狗的网站:
根据我的理解,所有img标签都需要一个alt标签:
p> < img src =Husky.pngalt =Husky/>
< img src =Rottweiler.pngalt =Rottweiler/>
对同一主题的多张图片使用相同的alt标签是一种很好的做法
< img src =Husky2.pngalt =Husky/>
< img src =Husky3.pngalt =Husky/>
< img src =Husky4.pngalt =Husky/>
在每个标签中使用title / alt标签是否是好习惯?
例子:
< ol title =This Dog>
< li title =这只狗>狗< / li>
< li title =这只狗>狗< / li>
< li title =这只狗>狗< / li>
< li title =这只狗>狗< / li>
< li title =这只狗>狗< / li>
< / ol>
< div id =body>
< p title =这只狗> < / p为H.
< p title =这只狗> < / p为H.
< p title =这只狗> < / p为H.
< p title =这只狗> < / p为H.
< / div>
我的理解是标题标签充当工具提示/鼠标悬停在较新的信息类型的东西上浏览器和alt标签用于在旧版浏览器中执行相同的操作。它们也可以作为搜索引擎识别您的网站的一种方法。
我希望自己的问题能够理解。
不, 您应该阅读属性的定义,它解释了它应该如何使用(不)。 code> alt 属性是 有很多规则你应该如何(不)使用这个属性。 因此, I hope I can post this. I understand the the purpose of the title and alt attributes, but I just do not understand the best use for them or if I can use the same title/alt more than once. For Example a website about dogs: From my understanding all img tags need an alt tag: Is it good practice to use the same alt tag for multiple pictures on the same subject Is it good practice to use a title/alt tag in every tag? What about using
the same tag more than a few times? Example: My understanding is that the title tag acts as a tool tip/hover over information type of thing in newer browsers and the alt tags use to do the same back in the older browsers. They also serve as a method for search engines to recognize your website. I hope I made sense in my questions. My understanding is that the title tag acts as a tool tip/hover over information type of thing in newer browsers and the alt tags use to do the same back in the older browsers. No, the The The You should read the definition of the attribute, it explains how it should (not) be used. The the value of the There are many rules how you should (not) use this attribute. So, the The 这篇关于关于标题/ Alt属性;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! alt
属性具有不同的含义/目的(不是旧方法与新方法)。
title
title
属性是全局属性,这意味着您可以在全部元素。一般来说(注意一个元素(例如 abbr
元素)它有一个特殊的含义),它被定义为:
标题
属性代表元素[...]的建议信息
alt
area
, input
(图片按钮)和 img
元素。对于 img
,它有含义:
lockquote
img
元素的后备内容,并为无法处理图像或具有图像的用户和用户代理提供等效内容加载被禁用。
alt
属性是图片的替代: EITHER 您会看到图片或,您可以阅读替代文字。 alt
值应不能作为图片的添加项提供/呈现。
title
属性给出了附加信息,这些信息将提供给两个(看到图像和阅读替代文字的用户)。但是,您不应该使用 title
属性作为重要信息的唯一方式,因为...
标题
值(在默认设置中)
<img src="Husky.png" alt="Husky" />
<img src="Rottweiler.png" alt="Rottweiler" />
<img src="Husky2.png" alt="Husky" />
<img src="Husky3.png" alt="Husky" />
<img src="Husky4.png" alt="Husky" />
<ol title="This Dog">
<li title="This Dog"> Dogs </li>
<li title="This Dog"> Dogs </li>
<li title="This Dog"> Dogs </li>
<li title="This Dog"> Dogs </li>
<li title="This Dog"> Dogs </li>
</ol>
<div id="body">
<p title="This Dog"> </p>
<p title="This Dog"> </p>
<p title="This Dog"> </p>
<p title="This Dog"> </p>
</div>
title
and alt
attributes have a different meaning/purpose (not old method vs. new method).
title
title
attribute is a global attribute, which means that you can use it on all elements. In general (note that one some elements (e.g. the abbr
element) it has a special meaning) it is defined as:
title
attribute represents advisory information for the element […]alt
alt
attribute can only be used on the area
, input
(for image buttons) and img
element. For img
, it has this meaning:
alt
attribute is the img
element’s fallback content, and provides equivalent content for users and user agents who cannot process images or have image loading disabled.
alt
attribute is an alternative to the image: EITHER you see the image OR you read the alternative text. The alt
value should not be given/presented as an addition to the image.title
attribute gives additional information, that would be provided to both (the users that see the image and the users that read the alternative text). However, you shouldn't use the title
attribute as the only means for information of importance, because …
title
value (in the default settings)