CSS code auto margin not working (CodePen)

Good day!

Appreciate it if someone could help me with my CSS code?

I’m working on my survey form now but I cannot put my form into the middle part of the preview pane, please help! I cross checked my code with the registration test but still wont work…

Hi, would be better to get the link to the codepen. But have you tried with semicolon after the auto keyword?

1 Like

You are right, sorry I just added the semi colon but still wont transfer to middle,
the youtube I am following got his to the middle with the same code…why cant I? :frowning:

I don’t know but as far as I can see there’re some problems with your html.
e.g.
<header> is not the same as <head>
Codepen html window is basically your <body> already - no need to mention it (apart from in your code it’s in the wrong place).
<input> is self-closing. Some text is left without any tags, etc.

Yeah I tried entering some stuff too like the HTML line, CSS link line but notifications popping up
Let me clean my html first

btw I got the CSS middle thing down,
I added width: 500px;

but Im gonna rework and try Div element instead or something

I would just go with margin: 0; and text-align: center; .Then your can work from there. And btw, using <fieldset> is convenient to style it later

this is made with the fieldset tag

Thanks, I think I will have to redo my project
I didnt use any fieldset, div, I just used straight stuff

Yeah, my guess is you need some blocks in order to center them with a margin property and text is just inline

How did you know that CodePen is already the “body” part?

I can’t remember, I’ve used it from time to time for quite a long time now.

Set ur margin to zero and auto
Like this; margin: 0 auto;

Thank you! finally finished it anyways…