Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Add Images to an HTML document

    htmlHTML 5

    Images make a great addition to a web page. In this lesson, we will use the <img> tag to add an image to our page.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    Instructor: Let's add an image, so we'll do an img. This is going to be the first time that we use an attribute. We're going to use the source attribute, src. Then we'll do an equals sign and two quotes. Within our quotes we're going to be giving the address of the image. I'm pasting in the address of a picture of a burrito.

    Let's add a second-level heading that says "burrito." Below the image, I'm going to add a paragraph giving credit for this burrito picture. Another important attribute of images is the alt attribute. This is text that's used to describe the image in case it can't load. If the image can't load, there's nothing there to indicate that there should be a picture there.

    The alt tab will let me write "basic burrito." We can now see that we have a broken image where our burrito should be. Putting our address back, our burrito is back as well.