CSS Treehouse Club: CSS My First Web Page Comments, Selectors, and Syntax

Cipriano Cuevas
Cipriano Cuevas
2,021 Points


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,050 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,624 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