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

Having trouble lining up 3 boxes with text in them

I am having trouble lining up three boxes with text inside them. The first box seems to work but the second box although I managed to make it inline with t0hre first box I cant figure out how to make all the text in the box. The third box both the box is not inline with the top of the other two boxes and I am having trouble placing the text in the center of the box. I have attached my code below- http://codepen.io/Johned22/pen/vKzAyd Thanks in advance

2 Answers

It's your margins (and padding) that are messing you up. I would say you should step back by removing margin and padding from all three, and then add what you need to get the effect you want. But you need to understand what each of these are: margin is the spacing outside the element, while padding is the space inside the element. You have different margin-top for each, so there should be no surprise that the tops don't line up. And you really shouldn't need to specify heights for these, they will grow as needed.

This is unsolicited advice, but I would suggest that you put all the styles that are the same in all three classes into another class called bubble and then only use bubble1, bubble2, and bubble3 classes for the attributes that you want to be different. It will be much easier to code, as well as to read. Good luck!

Thanks for your help. I think I have figured it out now.