"You should set the margin-left and margin-right properties of your div to auto"

I’ve already wrote the CSS code for this. It’s saying I should set my margin properties to Auto, which I’ve already done. Here’s my code:

div {margin-left: auto;}
div {margin-right: auto;}

Here’s the link to the challenge.

Learn Basic CSS by Building a Cafe Menu: Step 26 | freeCodeCamp.org

Before I give you the answer here’s a hint:

margin left & right needs to be in the same div element not separately.


Hmm, still don’t understand it. Here’s my current code now.

div {margin-left: auto; margin-right: auto;}

I just copied & paste your code into the challenge link and it said code passed.

div {
margin-left: auto;
margin-right: auto;

1 Like

Hi @Egaul98 ,

You have removed the starter code :

div {
  width: 80%;
  background-color: burlywood;

You should add the new properties within the already existing div selector.

1 Like

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