Web Development Foundations: The Box Model: Davie's Burgers

In #3 it asks for the .body elements inside .content to have no vertical margin and automatic horizontal margins so that it is centered. Is this a scenario where we have to use 3 instances of measurements such as * margin: 0px 0px auto * ? Is that valid? What should i put instead if this is wrong?

.content .body {
width: 90%;
margin: 0 0 auto

When you are setting top & bottom as the same value, and left & right as the same value, you use two instances of measurements:

.content .body {
  width: 90%;
  margin: 0 auto;
}

When do you declare three values?

Think of it this way, when you declare four measurements, they go in this order:

  1. Top
  2. Right
  3. Bottom
  4. Left

Two values:

  1. Top
  2. Right

Bottom matches Top, Left matches Right

And what if you declared only three?

  1. Top
  2. Right
  3. Bottom

Left will automatically match the Right value

So three values means: Top | Right & Left | Bottom

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.