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 trialArikaturika Tumojenko
8,897 PointsWhat's the downside of getting rid of the white space in the HTML?
What's the downside of writing your HTML code like this to eliminate white space between list elements?
<li><a href="#">ice cream</a></li><li>
<a href="#">donuts</a></li><li>
<a href="#">tea</a></li><li>
<a href="#">coffee</a></li>
It's just a personal preference? I find playing with negative margins to be more complicated since they depend on the font size.
2 Answers
Ashton Holgate
6,021 PointsI agree completely. For me it seems to make the most sense to exclude the list closing brackets, thus perfectly joining together the list items no matter the font size while writing less code, and then adding a margin-right value to add distance between the list items if necessary.
Perhaps Guil wanted to illustrate various methods? I'm not entirely sure why adding negative margins, which must be played around with relative to font size, is superior.
Steven Parker
231,248 PointsThe downside is that it can be a little hard to read and non-intuitive to maintain.
But the benefits can outweigh the drawbacks, and it is a perfectly valid and commonly-used technique.
However, you could specify margins in em units if you wanted them to adjust to font size changes.