The code example you gave is redundant and mainly pointless because it’s a duplication of the ‘alt’ attribute, which is not really how you are supposed to write ‘title’ attributes.
The ‘alt’ attribute is for ‘alternative text’ when the element cannot be rendered normally. The ‘title’ attribute gives additional ‘supportive information’ and may be rendered in a variety of ways. Just considering screen readers or assistive devices is a narrow approach to basic web accessibility.
You misunderstood my remark about the title tag. If you have both, browsers will display only the title tag as a popup, so you wouldn’t put your “credit” info in it. But if you have only an alt tag, IE will use that as the popup (FF and Chrome will not).
By hiding it in the title, people who use a keyboard and aren’t blind will never know. About 90% of the things I do in a day or most people do, i can without touching a mouse. Alt did pop up in the old days, but that was one of the things IE decided to do. The title isn’t read usually unless it cannot find the alt attribute.
You cannot have two alt attributes.
You can do what you suggestied alt=“Hawk flying over Green Lake; Credit: Ryan B - Wikimedia Commons”, but would advise against it. If your images are needing to be credited you should let everybody see. I am nearly 100% sure a photographer will scan your code to see if you hid credit in alt. Also it is not proper to put that info in an alt unless it is embeded in the image.
It may look better, but if they are putting that info into the alt, then that is improper. Unless, like I said the actual image has wikimedia in a corner. If it is via the title attribute that is fine, but a scree reader won’t announce it.
No, that’s not correct. “Title” will show up, in all browsers, when the user mouse-hovers on the image. If it’s missing, nothing should show up, but IE gets this wrong, and shows the “alt” content in that case. It shouldn’t do this, but it always has.
Technically, you should always have an “alt,” but a “title” is optional.
So - while redundant - I believe that is why the website I would like to mimic has an “Alt” and “Title” that are identical.
The two attributes (happy, now?) serve different functions, and generally shouldn’t have the same content. A regular visitor doesn’t need to be told, when he hovers his mouse over the hawk image, that it’s a hawk. He can see that.
The title is not announced via the screen reader IF an alt is specified. If you don’t give an alt but do a title, a screen reader will read it, however that is invalid code. You can make the title and alts the same, kind of pointless IMO.
Have a read of The alt and title attributes | 456 Berea Street