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 trialAdam Maley
5,946 PointsWould " Font-size: 0; " work to remove the gaps?
Would " Font-size: 0; " work to remove the gaps?
2 Answers
Joel Bardsley
31,249 PointsMustafa, the question is regarding gaps between inline-block elements.
Hi Adam,
Yes, using font-size: 0 on the parent element will indeed remove the gaps, and is my preferred method of doing it instead of messing around with negative margins.
You can see it in action with two unordered lists here - the first ul shows the default behaviour, while the bottom ul has font-size set to 0, and you can see the gaps have successfully been removed. Just don't forget to give the inline-block elements their own font-size declaration!
Mustafa Khan
6,224 PointsRemove the gaps for what? Also, it's better to use the display property and set it to none.
.thing-to-remove {
display: none;
}