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
Jessica Babka
721 PointsAdding an Image in HTML
I am really confused on how to add an image in the basic website section. I am using Notepad++. Every time I try to view my work in Chrome or Firefox there is no picture. I am trying to upload a picture from my laptop. But it's not working. Here is the code I am using: <img src="image/cupcake.jpg" alt="Smells Like Bakin"/> When I try to put my own picture in I just replace the word cupcake with the name of the picture I wanted to put in. I have tried googling it, but it doesn't work. Can someone please help me?
Thank you! I got the pictures in.
7 Answers
Lydia Tsai
6,509 PointsIs the picture that you want to use (your own picture) also in the same folder as your index.html file?
Chase Lee
29,275 PointsYou can display your code by wrapping it in " `` "
Kham Sanvoravong
7,277 PointsIf your index.html file is in the the same folder as your image.jpg file then you can use relative path in the img src attribute. When you double click on the index.html it should open in your default browser and bring up the image. You may also need to refresh.
<img src="image.jpg">
Elliott Frazier
Courses Plus Student 9,647 PointsBe sure to put your image in the same folder your index.html file is. otherwise it cannot locate the image.
Hope this helps!
Jessica Babka
721 PointsI put everything in the same folder. Downloaded all the pictures from the lessons. If everything is in the same file why won't they show up? Please help.
Kham Sanvoravong
7,277 PointsIt sounds like everything should work as is. Do you have the link to the lesson you're referring to?
Kham Sanvoravong
7,277 PointsAccording to the html file, your image should be in the folder called 'img'. The html tag would look like so... <img scr="img/your_image.jpg">
Jessica Babka
721 PointsHere's my code so far: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content=text/html; charset=ut f-8"/> <title>Smells Like Bakin' Cupcake Company</title> <link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen"> <link rel="stylesheet" href="css/grid.css" type="text/css" media="screen"> </head> <body> <div class="container clearfix"> <div class="grid_4"> <img src="img/logo.jpg" alt="Smells Like Bakin"> </div> <div class="grid_8 omega" <ul class="nav"> <li><a href="#">About</a></li> <li><a href="#">Cupcakes & Prices</a></li> <li><a href="#">Locations</a></li> <li class="last"><a href="#">Contact Us</a></li> </ul> </div> <div id="intro" class="grid_9"> <h1>Opposites really do attract, especially in our kitchen! We combine unexpected flavors that melt together to create ironically delicious desserts.</h1> <p><a href="#" class="btn">Browse Our Cupcakes<a/></p> </div> <div class="grid_3" omega> <img src="img/You-Bake-Me-Blush.jpg" alt="You Bake Me Blush"> </div>
<div id="featured-cupcake" class="grid_7">
<h2>Cupcake of the Week</h2>
<p>This week's featured cupcake is the <a href="#">Avocado Chocolate cupcake<a/>. It's strange combo of flavors will kick your taste buds into fiesta mode!</p>
<img src='img/featured-cupcake.jpg' alt="Avocado Chocolate Cupcake">
</div>
<div id="new-cupcakes" class="grid_5 omega">
<h2>Fresh Out the Oven</h2>
<p>Our newest cupcakes are <a href="#">Bacon Me Crazy</a> and <a href=#>Jalapeno So Spicy">
<img src="img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy">
<img src="img/new-cupcake-jalapeño.jpg" alt="Jalapeno">
</div>
<div class="grid_7">
<h2>Inside the Kitchen</h2>
<p>Smells Like Bakin' started out in the garage of the husband wife due Allison & Joseph. Allison is the baker, and Joseph found a way for them to make a business out of her tasty treats. Flash forward to today and they have a successful store front, catering business and cupcake truck.</p>
<p><a href="#" class="btn-small>Read More</a>" </p>
</div>
<div class="grid5_ omega"
<h2>Get Bakin' with Us</h2>
<div id="contact">
<p>Call us: <span>1-555-CUP-CAKE</span><br>
Email us: <a href="#">bakeon@smellslikebakin.com</a></p>
</div>
<p>We announce all of our new flavors first through Facebook & Twitter, even take requests!</p>
<a href="http:www.facebook.com/SmellsLikeBakin"><img src="img/facebook.gif" alt="Facebook"></a>
<a href="http:www.twitter.com/#!/SmellsLikeBakin"><img src="img/twitter.gif" alt="Twitter"></a>
</div>
<div id="copyright" class="grid_12">
<p>© 2012 Smells Like Bakin' Cupcake Company. All Rights Reserved. </p>
</div>
</div>
</body> </html>
Jessica Babka
721 Pointsit cut some of the code off...but the pictures in there, are they right?
Chase Lee
29,275 PointsWith what you have right now you should put your pictures in a file named 'img'.
Chase Lee
29,275 PointsJust another thing you forgot to close your "grid5_ omega", this is what it looks like <div class="grid5_ omega" this is what it should look like <div class="grid5_ omega">. Also you have to take <p><a href="#" class="btn-small>Read More</a>" </p> and put the second double qoute right after the btn-small like this <p><a href="#" class="btn-small">Read More</a></p>.
Jessica Babka
721 Pointsi made a new file called img and put the pictures in it. i am still really confused and the pictures still won't show up.
Chase Lee
29,275 PointsAre the names of the images what you call them in you markup?
Kham Sanvoravong
7,277 PointsThe only image that didn't show up was the jalapeno cupcake. To make that show up, you can change to a regular 'n' character. <img src="img/new-cupcake-jalapeño.jpg" alt="Jalapeno"> <img src="img/new-cupcake-jalapeno.jpg" alt="Jalapeno">
Kham Sanvoravong
7,277 Pointsfrom:
<img src="img/new-cupcake-jalapeño.jpg" alt="Jalapeno">
to:
<img src="img/new-cupcake-jalapeno.jpg" alt="Jalapeno">
Daniel Lewis
1,437 PointsMoved this thread to the HTML topic. Just a reminder that questions posed in General Discussion can not be marked with a best answer.
Chase Lee
29,275 PointsWith what you have right now you should put your pictures in a file named 'img'.
Jessica Babka
721 PointsJessica Babka
721 Pointsok i got 4 of the pictures in! thank you!
Jessica Babka
721 PointsJessica Babka
721 Pointsok i got 4 of the pictures in! thank you!
Kham Sanvoravong
7,277 PointsKham Sanvoravong
7,277 Points\o/ !!!
^__^