Home > Mobile >  I want to make forget password inline with cancel button
I want to make forget password inline with cancel button

Time:08-05

I want to make forget password inline with close button. I think there is an error. I change padding at a time and try to solve it but I couldn't find it. Help me to do this. Below my whole html and css codes for close button and forget password.
Html code

    <!DOCTYPE html>
<html>
<head>
   
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login</title>
<link rel="stylesheet" href="stylesheet_login.css">
</head>
<body>

   <h2>Login with your email</h2>
   
   <button  onclick="document.getElementById('id01').style.display='block'" style="width: 30%; ">Login</button>
   <button  onclick="document.getElementById('id02').style.display='block'" style="width:30%;">Signup</button>
   <button onclick="topFunction()" id="topbtn" title="to top">Top</button>
   
   <div id="id01" >
     
     <form  action="/action_page.php" method="post">
       <div >
         <span onclick="document.getElementById('id01').style.display='none'"  title="Close Modal">&times;</span>
         <img src="file:///F:/Yohani/python/Avatar_login_page.jpg" alt="Avatar" >
       </div>
   
       <div >
         <label for="uname"><b>Username</b></label>
         <input type="text" placeholder="Enter Username" name="uname" required>

         <label for="emal"><b>E-mail</b></label>
         <input type="email" placeholder="Enter E-mail" name="emal" required>
   
         <label for="psw"><b>Password</b></label>
         <input type="password" placeholder="Enter Password" name="psw" required>

         <label for="num"><b>Phone Number</b><label>
         <input type="number" placeholder="Enter Phone number" name="num">
           
         <button type="submit">Login</button>
         <label>
           <input type="checkbox" checked="checked" name="remember"> Remember me
         </label>
       </div>
   
       <div  style="background-color:#f1f1f1">
         <button type="button" onclick="document.getElementById('id01').style.display='none'" >Cancel</button>
         <span >Forgot <a href="#">password?</a></span>
       </div>
     </form>
   </div>

   <div id="id02" >
      </div>

   
    </body>
   </html>
   

css code

input[type=text],  [type=email] ,input[type=password] ,[type=number]{
   width: 100%;
   padding: 12px 20px;
   margin: 8px 0;
   display: inline-block;
   border: 1px solid #ccc;
   box-sizing: border-box;
   
 }
 

 button {
   background-color: #0985aa;
   color: white;
   padding: 12px 20px;
   margin: 8px 0;
   border: none;
   cursor: pointer;
   width: 100%;
   display:block;
   border-radius: 12px;

   
 }
 
 button:hover {
   opacity: 0.8;
 }
 

 .cancelbtn {
   width: auto;
   padding: 10px 18px;
   background-color: #f44336;
 }
 
 #topbtn {
   display: none; 
   position: fixed; 
   bottom: 20px; 
   right: 30px; 
   z-index: 99; 
   border: none;
   outline: none; 
   background-color: red; 
   color: white; 
   cursor: pointer; 
   padding: 15px; 
   border-radius: 10px; 
   font-size: 18px; 
 }
 
 #topbtn:hover {
   background-color: #555; 
 }
 
 .imgcontainer {
   text-align: center;
   margin: 24px 0 12px 0;
   position: relative;
 }
 
 img.avatar {
   width: 40%;
   border-radius: 50%;
 }
 
 .container {
   padding: 16px;
 }
 
 span.emal {
   float: right;
   padding-top: 16px;
 }
 span.psw {
   float: right;
   padding-top: 16px;
 }
 span.num {
   float: right;
   padding-top: 16px;
 }
 span.psw2 {
   float: right;
   padding-top:-100px;
 }
 
 
 .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;
   font-family:Arial, Helvetica, sans-serif;
 }
 
 
 .modal-content {
   background-color: #fefefe;
   margin: 5% auto 15% auto; 
   border: 1px solid #888;
   width: 80%; 
 }
 
 
 .close {
   position: absolute;
   right: 25px;
   left: 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.emal {
      display: block;
      float: none;
   }
   span.psw {
      display: block;
      float: none;
   }
   span.num {
      display: block;
      float: none;
   }
   span.psw2 {
      display:inline;
      float: right;
   }
   
   .cancelbtn {
      width: 50%;
   }
 }

Image of error I facing in this code.

CodePudding user response:

change the class name in bottom div

<div  style="background-color:#f1f1f1">
     <button type="button" onclick="document.getElementById('id01').style.display='none'" >Cancel</button>
     <span >Forgot <a href="#">password?</a></span>
   </div>

apply CSS rules as below

.container_bottom{
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 1rem;

}

CodePudding user response:

Adding the following modified CSS and HTML (indicated by the code comments) will provide you with a solution, though I recommend refactoring all of the HTML and CSS at some point.

.cancelbtn {
   width: auto;
   padding: 10px 18px;
   margin:  0;
   background-color: #f44336;
   float:  left; /* NEW LINE */
}

span.psw2 {
   float: right;
   padding-top:-100px;
   transform:translateY(75%); /* NEW LINE */
}

/* NEW CLASS SELECTOR .container.cancel after .container */
.container {
   padding: 16px;
}

.container.cancel {
   padding-top:  10px;
   padding-bottom:  10px;
   height:  50px;
}


<!-- add "cancel" class -->
<div  style="background-color:#f1f1f1;">
  • Related