I understand 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, take a website about dogs:
From my understanding all img
tags need an alt
attribute:
<img src="Husky.png" alt="Husky" />
<img src="Rottweiler.png" alt="Rottweiler" />
Is it good practice to use the same alt
attribute for multiple pictures on the same subject?
<img src="Husky2.png" alt="Husky" />
<img src="Husky3.png" alt="Husky" />
<img src="Husky4.png" alt="Husky" />
Is it good practice to use a title
/alt
attribute in every tag? What about using the same attribute more than a few times?
Example:
<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>
My understanding is that the title
attribute acts as a tooltip that appears when hovering over text. The kind of thing that has to be done in newer browsers but alt
and title
used to do the same thing back in older browsers. Those attributes also serve as a method for search engines to recognize your website.