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

How do I put space around my div elements (.left and .right) using CSS so that it doesn't look all jammed together?

3 Answers

Exactly like Christine said...

You could try something like:

.divName { margin-left: 10px; margin-right: 10px; }

or

.divName { margin: 0px 10px 0px 10px; }

or

.divName { margin: 0px 10px; }

As you can see, there are a few different ways you can add space 'around' a div.

Hope that helps! :)

When I added the margin it made one side above the other. how can I make them side by side? https://w.trhou.se/f7tkj7h25o

http://port-80-2mi5c84kkd.treehouse-app.com

If I'm understanding correctly, perhaps padding or margin would help.

Remember with margins it goes like a clock ie margin: 0 0 0 0; = top margin, right margin, bottom margin, left margin.