Search code examples
htmlcssformscenter

Centering a form with CSS


I have written a form in html/css using the following code:

.login_form_wrapper{
float:left;
padding:60px;
width:55%;
padding:80px 100px 78px 100px;
text-align:center;
}

How do I center the so that it neatly fits inside the center of the users screen?

I have tried to edit the CSS for the past several hours with no joy.

Any help would be appreciated.

Cheers


Solution

  • I imagine that the CSS classes you are using are used in more than one place. What is causing your issue is that on this wrapper DIV:

    <div class="login_form_wrapper register_wrapper">

    you have classes applying float: left; this needs to be removed and add margin: 0 auto;