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
Monique Clement
4,517 PointsNo space between my images
When I was building the simple website the two images, new-cupcake-bacon.jpg and new-cupcake-jalapeno.jpg, appeared without any space between them. That didn't seem so bad at first but then I finished the whole project and after adding the border, margins etc those two images clearly don't line up with the other image, featured-cupcake.jpg. What did I do wrong?
7 Answers
Monique Clement
4,517 PointsOkay, it's fixed now. I really thought the problem started when the images had no space between them but it turns out I put in the word "combination" instead of "combo" and the longer word was enough to mess up the alignment. Thank you both anyway!
Nick Stellato
Front End Web Development Techdegree Student 33,994 PointsCan you post a sample of your code? The easiest way to answer these questions is to take a look at the actual html and css.
Monique Clement
4,517 PointsI hope this helps:
<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 a strange combination of flavours that 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</a>. </p>
<img src="img/new-cupcake-bacon.jpg" alt="Bacon Me Crazy">
<img src="img/new-cupcake-jalapeno.jpg" alt="Jalapeno So Spicy">
</div>
Alexander Torres
2,963 PointsCan I get an image of the CSS code too? I think the error might be in the CSS code, since I did that project and your HTML code seems to be exactly the same as mine. Thanks
Monique Clement
4,517 PointsI don't think the problem is in the CSS code because early on in the project before I added any CSS I noticed there was no space between those two images. Just in case, here's the CSS:
#new-cupcakes img {
border: 8px solid #FAF3BC;
margin: 0 0 20px 0;
}
#featured-cupcake img {
border: 8px solid #FAF3BC;
}
Alexander Torres
2,963 PointsYeah everything looks good, at least on those parts of the code you gave us. Maybe someone with more advanced knowledge can put in their two cents.
Nick Stellato
Front End Web Development Techdegree Student 33,994 PointsHere is what I would do to fix it. I would take the #featured-cupcake img block and move it above the #new-cupcakes img block. I prefer to have specific stylings target an html element in the order that they appear on the page.
Also, when I try to target a child of an element, I always use a child selector. I would change the css to read:
#featured-cupcake > img {
//your code
}
#new-cupcakes > img {
//your code
}
Let me know if that helps.
-Nick