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 Introduction to HTML and CSS (2016) HTML: The Structural Foundation of Web Pages and Applications Paragraph Tags

Stanley Nkosi
Stanley Nkosi
4,233 Points

Give the image tag a src attribute with a file path of" images/spain.jpg" Stanley

How do you give the image tag a src attribute with a file path of" images/spain.jpg".?

Stanley Nkosi
Stanley Nkosi
4,233 Points

Thanks Jamie that's the best answer.

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

An attribute is kind of like a special "setting" that you can give a HTML tag. 2 of the most common are "alt" and "src". In the main you'll use "src" for image tags and this is how you define a path.

It works like this

<img src="path/to/image.png" alt="Altternative text goes here" />

Now the type of file path used here is known as a relative file path. That means it's referring to the path from the location on of the current HTML document.