How do I center my register/login form into the exact middle and center of the page. Right now I have it centered but it's at the top of the page instead of the middle. This is my CSS:

form {
        width: 300px;
        margin: 0 auto;


Try this:

.parent {
  position: relative;
.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

replace .parent and .child accordingly.

or just put your form in a div with the class that has the followeding rule added to it's rules:

margin: 0px auto 0px auto;

You can adjust the alignment of the form with respect to its percentage to make it available in the middle.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.