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! While you're at it, check out some resources Treehouse students have shared here.

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

HTML

Angus Eliott
Angus Eliott
3,793 Points

adding images

could anyone give me the code for adding images?

2 Answers

Russell Kree
Russell Kree
1,956 Points

<img src="" alt="" style="width:100px;height:100px;">

Thomas Fildes
Thomas Fildes
22,687 Points

Hi Angus,

To add images you use the <img> tag but you need put two attributes inside this tag (src and alt). Src is the source and alt is the alternate text that appears when the image is broken etc. Here is the code below where i've included sample attribute values. (Make sure your image is in the correct directory too)

<img src="example.jpg" alt="Picture of a ???">