Can't center element with CSS

To begin, I completed the Survey Form without too much trouble and by referring to the previous Registration Form we had to make. However, when opening the site on my browser (Chrome), my fieldset wasn’t centered (it was centered on the freeCodeCamp preview). I’m a beginner, and have no idea what I should do. Here’s my code, any help would be very much appreciated -

I think maybe margin would help?
Here’s what I think could work.
Please contact me if it doesn’t work.

  background-color: #EEE49C;
  margin: auto auto;
  padding-left: 20px;
  text-align: left;
1 Like


You have to center the form:

In your CSS to the form set display to block, auto margin left and right, done!
If you need further help, just let me know.

Also add this code to your body CSS:

background-repeat: no-repeat;
background-position: bottom;
background-size: cover;

and look what happens to the image :wink:

1 Like

Thank you! I was also wondering how to stop the image from repeating but then I said to hell with it :smiley: Really appreciate it!

You forgot to add the unit for the number 30;
form {
margin: 30px auto;

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