My login form is currently positioned to the left. However, I am trying to move it to the center of the page. I attempted some CSS styles without success. Interestingly, when I removed '{% extends "common/base.html" %}' from the code, the form did center itself even without any specific CSS styling or navigation bar present.
Here is my HTML code along with the added CSS style:
{% extends "common/base.html" %}
{% block content %}
<div class="main-login", id="parent">
<form align="center" action="/login" method="POST" >
<div class="login-screen">
<div class="app-title">
<h1>Login</h1>
</div>
<div class="login-form">
<div class="control-group">
<input type="text" class="login-field" value="" placeholder="username" name="username">
<label class="login-field-icon fui-user" for="login-name"></label>
</div>
<div class="control-group">
<input type="password" class="login-field" value="" placeholder="password" name="password">
<label class="login-field-icon fui-lock" for="login-pass"></label>
</div>
<input type="submit" value="Log in" class="btn btn-primary btn-large btn-block" >
<br>
<p>{{ _('New User?') }} <a href="{{ url_for('auth.register') }}">{{ _('Click to Register!') }}</a></p>
<p>
{{ _('Forgot Your Password?') }}
<a href="{{ url_for('auth.reset_password_request') }}">{{ _('Click to Reset It') }}</a>
</p>
</div>
</div>
</form>
</div>]
Here is my CSS code:
.main-login{
padding-top: 100px;
text-align: center;
width:500px;
/*align-items: center;*/
vertical-align: middle;
}
#parent {
/*display: table;*/
width: 50%;
vertical-align: middle;
text-align: center;
}
.login {
margin: 20px auto;
width: 300px;
}
.login-screen {
/*background-color: #FFF;*/
padding-top: 1000px;
background-color: #3498DB;
padding: 20px;
border-radius: 5px;
text-align: center;
}
.app-title {
text-align: center;
color: #777;
}
.login-form {
text-align: center;
}
.control-group {
margin-bottom: 10px;
}
input {
text-align: center;
background-color: #ECF0F1;
border: 2px solid transparent;
border-radius: 3px;
font-size: 16px;
font-weight: 200;
padding: 10px 0;
width: 250px;
transition: border .5s;
}
input:focus {
border: 2px solid #3498DB;
box-shadow: none;
}
.btn {
border: 2px solid transparent;
background: #3498DB;
color: #ffffff;
font-size: 16px;
line-height: 25px;
padding: 10px 0;
text-decoration: none;
text-shadow: none;
border-radius: 3px;
box-shadow: none;
transition: 0.25s;
display: block;
width: 250px;
margin: 0 auto;
}
.btn:hover {
background-color: #2980B9;
}
.login-link {
font-size: 12px;
color: #444;
display: block;
margin-top: 12px;
}
I have included an image link below to illustrate the desired outcome where the login button's length matches that of the password field: