Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,052 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,631 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