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 How to Make a Website Styling Web Pages and Navigation Style the Image Captions

pictures are not sizing correctly

after putting in the following CSS code the pictures actually overlap instead of doing what is seen in the video.

gallery {

margin:0; padding:0; list-style:none; }

gallery li {

float: left; width: 45%; margin: 1.5%; background-color: #f5f5f5; color: #bdc3c7; }

gallery li a p {

margin: 0; padding: 5%; font-size: 0.75em; color: #bdc3c7; }

i've looked at this several times to no avail. Even played around with the number values to see what would happen.

Lush Sleutsky
Lush Sleutsky
14,044 Points

Hard to give an answer without seeing what you're trying to do...

Refer to the "Markdown Cheatsheet" at the bottom of the very box you write posts with, so we can see the code and go from there. It could be that you're not clearing floats, it could be you're not targeting the right element, etc.

From what you gave so far, an answer is not possible to provide, unfortunately...

Also, something about the last line where a p element follows an a tag, which is nested inside an li element - just seems like that isn't right, just from looks alone; but again, I could be wrong. Hard to say without seeing the code. Markdown my friend, Markdown!!

2 Answers

Shawn Williams
Shawn Williams
14,762 Points

The margin on gallery li is incorrect, try adjusting this and see what happens.

thanks i discovered the problem. I'm following along with the videos and the following line of CSS is missing in the video style your portfolio.

#gallery li img { 
  width: 100%;
}```

i discovered this in the forum for that particular video. Thanks  Hopefully i did the markdown correctly this time.