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 Treehouse Club: CSS My First Web Page Comments, Selectors, and Syntax

Cipriano Cuevas
Cipriano Cuevas
2,021 Points

Margin

I've tried to move the margin but it just keeps moving everything to the left, how can I play around with the margin?

3 Answers

Justin Cantley
Justin Cantley
18,068 Points

The margin isn't something that you move on its own. You do however expand and contract a margin around an element. There are several margin properties you can apply to an element's margin such as margin, margin-bottom, margin-top, margin-left, and margin-right. If your elements are moving to the left that means there is a margin-right value. example:

p {
 margin-right: 10px;
}

It doesn't see like anything is moving when i change the margin. I'm doing something wrong? I typed in the information based on the video.

Ezra Siton
Ezra Siton
12,644 Points

its hard to know without your code. Anyway, maybe you trying to add margin to inline elements (margin doesn't work with display: inline).

Related: https://stackoverflow.com/questions/8782634/margin-position-and-padding-not-working-when-displayinline-is-set-also-weird