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

CSS

Having some trouble with a caption I'm trying to add to a image.

I'm trying to add a caption to a image, just a small description about the image, and who owns the image. Now the problem I'm having is that there's a small space between the image and the caption. If tried to set the margin to 0 with the left class, just messing around, and that just puts the text too close to the margin. I've also tried to setting the caption class to margin zero, but nothing happens. Also is it possible to get the background to be the same length as the image? As you can tell with the browser window maximized the background is longer then the image. If anyone could help me with the I would really appreciate it, and thanks in advance for any help.

Here's my codepen link: http://codepen.io/mike316/full/pgKia/

I know you won't beable to see the image, but hopefully someone else has had this problem, and they know how to fix it.

3 Answers

How about some negative margin like so:

.caption {
  margin: -10px 0;
}

Not sure if I understand your question to it's fullest, on my way to bed ;)

That did it. But, the background is still too long. The width of the image is 45% I did try to set the width of the caption to 45% but, I will continue to play around with the width property more. Thanks a million John!!!

My pleasure buddy :)

I´ll help you more tomorrow, if you are still stuck on the rest.

Did you need more help Mr. X?

Also would you please trow in a Best Answer on my post mate?

Cheers :)

try to add padding to image

I did what you said, it just pushed the text farther away because it makes the image smaller. Thanks for the help though.

Sure will John I was waiting to see if anymore activity was coming. As far as the captions under the pictures goes, yeah I think I figured it out. Thanks man.

Happy to help out mate.

Thanks for the vote.