i have a login form, whose code is lie below:
.samaraveera {
box-sizing: border-box;
padding-right: 22%;
padding-bottom: 3%;
padding-top: 3%;
display: block;
margin: 4%;
padding-left: 17%;
}
.samaraveera:focus + .errspan {display: none;}
.container-login100-form-btn {
width: 97%;
margin-top: 2%;
margin-left: 1%;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.login100-form-btn {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
align-items: center;
padding: 0 20px;
width: 100%;
height: 35px;
border-radius: 3px;
background: #f2136e;
font-family: Montserrat-Bold;
font-size: 12px;
color: #fff;
line-height: 1.2;
text-transform: uppercase;
letter-spacing: 1px;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
transition: all 0.4s;
}
.login100-form-btn:hover {
background: #0cc3eb;
}
<input class="samaraveera" type="text" placeholder="Phone Number">
<span class="fa fa-phone errspan"></span>
</div>
<div class="sellois">
<input class="samaraveera" placeholder="Password" type="password" name="pass">
<span class="fa fa-lock errspan"></span>
</div>
<div id="paaths" class="container-login100-form-btn">
<button class="login100-form-btn">
Sign in
</button>
</div>
when the input box is focused for entering values, its moving. And the password input box is colliding with login button like below image:
I have one more issue with this input box, when the page loads it loads with the correct width, when I enter some value or focus the input box then the width of the box increases a bit. can anyone please tell me what could be the problem here, thanks in advance
First try to use container aligned in center of screen I think. After that your inputs needs to be in certain width to block them from moving.
.container {
position: fixed;
width: 300px;
height: 300px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px;
}
.form-title {
width: 300px;
height: auto;
padding: 10px;
}
.form-item {
width: 100%;
height: 30px;
border: 1px solid #929292;
border-radius: 5px;
display: flex;
flex-direction: row;
align-items: center;
transition: all .3s;
margin-bottom: 10px;
}
.form-item:focus-within {
border: 1px solid #ffffff;
}
.icon {
width: 10%;
height: 30px;
background-color: #f2136e;
}
.form-item [type=text], [type=password] {
width: 90%;
background-color: transparent;
border: none;
}
.form-links {
text-align: center;
margin-bottom: 20px;
}
.form-links a {
text-align: center;
text-decoration: none;
color: #f2136e;
font-size: 14px;
}
.form-btn {
width: 100%;
height: 40px;
}
.form-btn [type=button]{
width: 100%;
height: 40px;
background-color: #f2136e;
border: none;
color: #fff;
border-radius: 5px;
}
.form-register{
width: 100%;
height: 40px;
}
.form-register [type=button]{
width: 40%;
height: 40px;
background-color: transparent;
border: 2px solid #f2136e;
color: #f2136e;
border-radius: 5px;
}
<div class="container">
<div class="form-title"> LOG IN </div>
<hr/>
<div class="form-item">
<div class="icon"></div>
<input type="text" name="phone-number" placeholder="Phone number">
</div>
<div class="form-item">
<div class="icon"></div>
<input type="password" name="phone-number" placeholder="Password">
</div>
<div class="form-btn">
<input type="button" name="submit" value="Sign in">
</div>
<div class="form-links">
<a href="#">RESET PASSWORD</a> | <a href="#">LOGIN WITH OPT</a>
</div>
<div class="form-register">
<input type="button" name="register" value="SIGN UP HERE">
<span> NEW USER? </span>
</div>
</div>