Creating Alternative Text - The ALT Tag
In our last video we created our first image. In this video we will talk about what happens when an image can't be found. More then that how can we tell search engines what is actually in it. The way to do it is really simple. Just the same way as we created a new attribute for the source of our image we do the same for alternative text. the name of the attribute of alternative copy is alt
alternative text for images enables us to create copy that helps search engines and visually impaired users understand the meaning of our images.
Video Transcript
00:00Okay, - Does it make sense ? -yeah
00:03I want to learn a couple of more attributes. Now that we know what attributes are,
00:07What would happen if by mistake we didn't have an image here ?
00:14If we had some sort of a spelling error, and let's say we put here: 2 - so it's an image that doesn't exist
00:20and we go into our browser and we click on refresh, we'll see that we have here this weird question mark
00:26because it couldn't fin our file,
00:28now, different browsers would render it dfferently
00:31But sometimes the file won't load not because the name was not alright, sometimes it won't load
00:36because you're running it on the server and the file just couldn't load
00:40Again, blind users or people that can't see or search engines they don't really know
00:44what's inside of the image.
00:45We really want to tell the browser the most that we can to make it easier for both users and search engines
00:52to know what do we mean by this image,
00:55To do that, the way we do it is very very simple,
00:57in our code itself we're going to meet another attribute,
01:01because line breaks don't mean anything in HTML we could very easily break a line here just for aesthetics
01:08just to make it easier for us to look at things
01:12It's as if I didn't put a line-break, it's completely fine, copletely legal, we don't have to worry about it
01:16so the attribute I want to learn about is 'alt'
01:20which is basically alternative copy.
01:22or alternative text
01:24So the alternative text I could put here is basically a copy I want here for blind users and search engines
01:29to know the meaning of that image
01:32so in our case, because the image didn't load,
01:34let's say here 'the best XML training on discount'
01:44So we got here a little bit of extra information,
01:46and let's make it a little bit smaller, so everything is on the screen at the same time,
01:50so 'the best xml training on discount' and if I click on save and go to the browser
01:54we click on refresh, we're going to see that if we put our mouse over the image,
01:59in most browsers at least, in our case it's not working on Safari for some reason,
02:05but we should have got that extra information that's just a copy,
02:09but even if we don't see it , don't worry about it.
02:11one of the stuff is also that blind people will see it, search engines will see it, most browsers -
02:17in our case it's kind of embarrassing, because I thought we would see it just by rolling over it
02:21but in our case Safari is not as smart I guess and it doesn't give us that extra information,
