Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Build a Simple Website Text Editors and HTML Images and Lists

How to put an image in the body

I dont understand how to make an image code

I got it thanks!

3 Answers

Emma Willmann
.a{fill-rule:evenodd;}techdegree seal-36
Emma Willmann
Treehouse Project Reviewer

You need to use an image tag between the body code. The picture is inside a folder named img in the same directory as the file your working on, so you need to make sure you reference that folder by making the source of the image tag be img/cupcake.jpg. The code should look like this:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Smells Like Bakin' Cupcake Company</title>

    <img src="img/cupcake.jpg" alt="">        

I got it thanks!

Sergio Slansky
Sergio Slansky
22,392 Points

Like the above code example<img src="folderlocation/imagename.ext" alt="" name="">

You can include an inline style within the image code, dimensions, captions, etc. Just find where in the code you want to put the image and then make sure your naming the exact location of the image, and the exact name of the image with the correct extension (.jpg, .png, .gif)

You can add a image with the img tag. The img tag requires an attribute called src. This is the url of the image file, it can be a Relative URL or an Absolute URL.


    <img src="image.jpg" alt=""> 


This is an example of a Absolute URL


    <img src="http://upload.wikimedia.org/wikipedia/commons/e/ee/Ascanius_Shooting_the_Stag_of_Sylvia_1682_Claude_Lorrain.jpg" alt=""> 


I hope this helps :)

If this didn't answer you question, give me some feed back and ill help you though it.