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 How to Make a Website Creating HTML Content Add Image Gallery Content

img src tag

Hi guys

When entering this tag: <img src with a space in between, the works pace editor keeps hi lighting it with the red color, but if I use imgsrc "one word" it will remove the it.

any Idea? Thanks Aldo

2 Answers

Justin Hicks
Justin Hicks
14,290 Points

The correct way to insert an img tag is <img src="yourimg.jpg"> if I remember right the img tag is a self closing tag. also remember which ever file type your image file is to incluse that at the end such as <img src="yourimg.jpg"> <img src="yourimg.gif"> <img src="yourimg.png"> and so on. Hope this helps you out.

Shane Oliver
Shane Oliver
19,977 Points

To assign values to an element's properties you use the equals sign. An image element needs a src property which can be declared like so

<img src="image.jpg" />