Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,291 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.