This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

How to add an images to a website using HTML what is alt

Daniel Walter Scott

Download Exercise Files Download Completed Files



We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.


I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link:

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
All right, this video is all about adding images to your HTML. It's pretty easy, let's jump in now and learn how to do it. 

To add our image, we're going to put it inside the Header. So, clicking in between the Header, angle brackets, put a 'Return' in. We're going to use IMG, that's the kind of shortened version of the tag that describes an image. I hit 'Return', and it puts in all the junk we need. So the image source, just where it is. It's nowhere at the moment, so we need to put it in a place inside of our local folder. So let's do that first. 

So what we're going to do is we're going to jump out to our Finder. On a Mac, it's called Finder, on your PC it's called Window-- so, find your My Documents panel, get this up. And on your desktop, inside of your Project 1, we've got Index and Style, but we need to put our image in here. And it's really common not to just dump it sitting kind of in with these guys. You put them in a group, in it's own little folder called Images. 

So we're going to right click, I'm going to make a new folder. That's basically the same on Mac or PC. You either call it IMG or images. I call it images. Half the world calls it IMG, the other half of the world calls it images. I call it images. It's not good or bad but yeah, you have to take sides. So we've got a folder in there called Images, there's nothing in it. So let's go into our Exercise Files. Let's go to Project1, and inside of here, there's a PNG called logo-adere-restaurant. I'm going to right-click it, I'm going to copy it, just copy. My shortcuts you can tell. Can I copy? There you go, Copy, or Command C, or Ctrl C on a PC. 

Let's go back to our Desktop and paste it in. 'Desktop', 'Project1', 'Images'. Right click, paste item, and there he is. So hasn't really done much. I guess it brings up a really good point; everything in this website needs to be in this folder called Project1. Remember, doesn't have to be called Project1, but everything has to be inside of here. It's called the root of the website. So it needs to know that this is Home base, and it doesn't need to know the rest of your computer exists. Just needs to know this, like little folder, is its own little world. 

So under 'Image Source', so I just typed in 'im', I just started typing 'im', you can see it goes, "Hey, I've looked into your root folder and I've seen this folder called images, would you like to use that?" and you're like, "I would." If it doesn't appear it's probably broken. You need to go make sure that Images folder is in the right place, but if it's still not working just type it in. IMG, and then you need a forward slash, to say, I'm inside that folder, and what's inside that folder? There's only one thing. It's pretty clever. Now let's save it, 'Save All', and let's preview in a browser. There it is. It's Left Aligned, we're going to move it into the middle, but that's how you add an image; pretty easy. 

The Alt Text is super important when you're adding images. Basically Alt Text is short for alternative, and it just means, if this image didn't load, what text would best describe this image? And this is going to be the logo for Adare Restaurant. Is that what I called it? It is. Adare Restaurant, that's my restaurant. So that describes that image. And why we do it is, for a couple of reasons. The visually impaired will have a screen reader that will read them the website. So obviously if you can't see the logo you need to be described what it is. So it needs to be a very good descriptor for people getting read out your website. 

The other thing is that Google uses it to help kind of work out what your site's about. So if you just put logo, that's fine, but you might as well put in, for Adare Restaurant, because if somebody's searching for Adare Restaurants, and your website is very clearly, for Adare Restaurants, it helps your rankings. So make sure Alt Text is really clear what it is, but also, is very specific to your kind of target. In our case we want people looking for restaurants in this town called Adare, where I'm moving to in a couple of weeks, can't wait, anyway. 

That's going to be it for this video, we've put in an image, we'll do how to create images out of programs later on in the course. We'll separate that out, we'll do Photoshop, Illustrator, and XD, how to make images. The one thing all of you need to know if you are creating them now is, that they shouldn't have any spaces. If I have a space there, or at least in the file that I've made, in my Images folder, that shouldn't have any spaces. Same rules as naming these. Should have underscores or hyphens, or, doesn't matter if it has no spaces. So just make sure, no spaces. All right, now the next video; let's go.