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

Mystery Padding/Margin?

I have a sub-nav UL of labels that appears to have some sort of mystery padding or margin to it. It's pushed to the left by about 10px. If I add padding: 0 to the .labels class, it aligns correctly on the left... but then the content next to it appears to cave in on it (by about 10px) from the right. I can add 10px of right padding to the .labels class to "fix" it all... but there must be something I've done wrong/missed that is causing it in the first place.

Any help would be greatly appreciated!

.label a {
    color: #ffefbf;
    padding: 5px 10px;
    background-color: #663F61;
}

.label li:not(:last-child) {
    margin-right: 10px;
}

.label li {
    display: inline-block;
    list-style: none;
}

I did try commenting out my not-last-child margin rule to see if that corrected it, but it did not. :(

2 Answers

Hi Ashley,

Can you put it into a codepen for us?

Hi Gary!

I actually just realized that it wasn't an issue with the UL, it was something to do with how I had my divs aligned with their grid classes. Once I corrected that, simply setting the padding to 0 did solve the issue without any other weird changes. :)

Thanks for responding, anyway!