I need a little help. My modal form appears messy when I put it inside my project. On the other hand, when I create a separate page, it appears perfectly as it should be. Here is the code:
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
.container {
padding: 15px;
}
span.psw {
float: right;
padding-top: 16px;
}
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4);
/ padding-top: 60px;
}
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto;
border: 1px solid #888;
width: 80%;
}
.close {
position: absolute;
right: 25px;
top: 0;
color: #000;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
@-webkit-keyframes animatezoom {
from {
-webkit-transform: scale(0)
}
to {
-webkit-transform: scale(1)
}
}
@keyframes animatezoom {
from {
transform: scale(0)
}
to {
transform: scale(1)
}
}
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
<div id="id01" class="modal">
<form class="modal-content animate">
<div class="imgcontainer">
<span class="close" title="sair">×</span>
<img src="img/users.png" alt="users" class="avatar">
</div>
<div class="container">
<label for="uname"><b>E-mail</b></label>
<input type="text" name="uname" placeholder="Entre com o seu e-mail" required>
<label for="psw"><b>Senha</b></label>
<input type="password" name="psw" placeholder="insira sua senha">
<button type="submit">Entrar</button>
<label>
<input type="checkbox" name="lembrar" checked="checked">Lembre-ne
</label>
</div>
<div class="container" style="background-color: #f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancelar</button>
<span class="psw">Esqueceu a <a href="">senha?</a></span>
</div>
</form>
</div>
<button type="button" onclick="document.getElementById('id01').style.display='block'" class="cancelbtn">Exibir modal</button>