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
brandonlind2
7,823 PointsWhy is there a 1-2px gap between my image and caption?
i cant find any margin, so I'm confused as to what the cause is and how to remove it. You cant see the image but you can see the grey border with the gp bewtween the caption and the image still https://jsfiddle.net/nyftp2b7/11/
caption-clr {
background-color: rgba(0, 0, 0, .1);
}
body {
background-color: lightgreen;
}
<figure class="main-image">
<a href="img/cannabislegalmap.png">
<img src="img/cannabislegalmap.png" width="100%" alt="Image of a map of states were recreational cannabis is legal">
</a>
<figcaption class="caption-clr">States were recreational cannabis use is legal.
</figcaption>
</figure>
1 Answer
Laurie Curiant
8,965 Pointshttps://jsfiddle.net/1sevsa7e/
Image is an inline object, it have a line-height. When you add a 'display: block' to it, there is no more gap
brandonlind2
7,823 Pointsbrandonlind2
7,823 PointsThank you!!