Login is creating a bottom spacing with CSS

Asked

Viewed 50 times

1

Guys, I have this css code for Login. What happens is that there must be some error because I get a huge spacing at the bottom of the screen. inserir a descrição da imagem aqui

I leave you my code

    <style>

/* Full-width input fields */
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;
}

.inicioenter{
  position: absolute;
  left: 35%;
  top: 35%
}

/* Set a style for all buttons */
button {
    background-color: #4CAF50;
    color: white;
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    cursor: pointer;
    width: 100%;
}

button:hover {
    opacity: 0.8;
}

/* Center the image and position the close button */
.imgcontainer {
    text-align: center;
    margin: 24px 0 12px 0;
    position: relative;
}

img.avatar {
    width: 20%;
    border-radius: 20%;
}

.container {
    padding: 13px;
}

span.psw {
    float: right;
    padding-top: 16px;
}

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    padding-top: 30px;
}

/* Modal Content/Box */
.modal-content {
    background-color: #fefefe;
    margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
    border: 1px solid #888;
    width: 50%; /* Could be more or less, depending on screen size */
}

/* The Close Button (x) */
.close {
    position: absolute;
    right: 25px;
    top: 0;
    color: #000;
    font-size: 35px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: red;
    cursor: pointer;
}

/* Add Zoom Animation */
.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)}
}

/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
    span.psw {
       display: block;
       float: none;
    }
    .cancelbtn {
       width: 100%;
    }
}
</style>

The HTML I’m using:

    <body>

    <div class="inicioenter">
        <center><h2>Iniciar Sessão</h2>
        <button onclick="document.getElementById('boxmodal').style.display='block'" style="width:auto;">Entrar</button></center>

    </div>

    <div id="boxmodal" class="modal">
      <form class="modal-content animate"  method="post">
        <div class="imgcontainer">
          <span onclick="document.getElementById('boxmodal').style.display='none'" class="close" title="Close Modal">&times;</span>
          <img src="img\profile-image.png" alt="Avatar" class="avatar">
        </div>

        <div class="container">
          <label for="uname" class="center-align"><b>Username</b></label>  
          <input id="username" type="text"  name="username" class="validate" autocomplete="off" required>

          <label for="password" class="center-align"><b>Password</b></label>
          <input id="password" type="password" class="validate" name="password" autocomplete="off" required>

          <div class="container2">
            <input type="submit" name="signin" value="Entrar" class="btn waves-effect waves-light">
          </div>


        </div>  
      </form>
    </div>

<!-- Abrir caixa de Login -->
<script>
      // Get the modal
      var modal = document.getElementById('boxmodal');

      // When the user clicks anywhere outside of the modal, close it
      window.onclick = function(event) {
          if (event.target == modal) {
              modal.style.display = "none";
          }
      }
</script>

<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>

</body>
</html>
  • I could not understand what happens! Login is a modal and you want to open it in the middle of the screen is this?

  • Also put the HTML in the question ok

  • In addition to placing the HTML screen, also inform the version of Bootstrap you are using.

  • @Leandrade Yes, what happens is that the login box stays until the middle of the page. The bottom part does not appear anything (part surrounded by red). and I wanted to center in the middle of the page

  • @sam I’ve already added. I’m using materialize.

  • @hugocsl added

Show 1 more comment

1 answer

0


The Materialize is defining the height maximum modal in 70% of the screen, so the empty space below.

inserir a descrição da imagem aqui

Redefines the max-height in class .modal in 100%, or a value that nullifies the value defined by Materialize 70% (none, or inherit):

/* The Modal (background) */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    padding-top: 30px;
    max-height: 100%; /* 100%, none ou inherit */
}
  • Thank you very much, it’s settled.

  • No friends! In fact, just cancel the value of 70% of Materialize. Whatever put 100%, none or inherit. Abs!

  • Saved my login ;) thank you very much

  • can you please see if you can help me with this other difficulty: https://answall.com/questions/328318/n%C3%A3o-grava-dados-com-mysql thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.