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

Nicolai Knoll
9,481 PointsMulti-column layout: unwanted line-break in first column
Hi, I just went through the multi-column layout video in the CSS deep dive.
Afterwards I tried to set up a multi-column layout myself using the -webkit-column-count (or the -webkit-columns) tag but both webkit browsers, Chrome and Safari, create an empty first line at the beginning of the first column.
I set margins, paddings and top position to zero but nothing helps.
I created an example over here: http://codepen.io/knicolai/pen/qsabE
Can anyone help?
3 Answers

Sean T. Unwin
28,690 PointsParagraphs are block elements and they have top and bottom margins internally set to, well, make them look and behave like paragraphs.
To counter this for your use case you could set the <p>
tags to display: inline
but this would remove the margins for all your paragraphs so this is not realistic as there would be no separation at all.
Alternatively, you could use <span>
tags. Although this would have the same effect as above where the paragraphs would bleed together.
So for this example I would suggest using the following:
.main > p:first-child {
margin-top: 0;
}
.main > p:last-child {
margin-bottom: 0;
}
This way we only remove the "offending" white-space while keeping the rest of the layout display intact.
View the result: http://codepen.io/seantunwin/pen/KBCca *
- I added a border and a little padding to the container
- You could add some additional
padding-top
(1em looked balanced to me) to the container to balance out the white-space the at the bottom OR remove themargin-bottom
for all<p>
tags, as long as you don't adjust themargin-top
for all<p>
tags, aside from the first, then it will still look appealing when screen-size is adjusted or reduced (column fluidity).

Nicolai Knoll
9,481 PointsThanks Sean! Got it!

Tavo Zambrano
5,240 PointsWorked like a beauty Sean! Thanks for sharing, I was having the same trouble.