0% found this document useful (0 votes)
33 views3 pages

Modal Login Form Design Template

The document is an HTML code for a modal login form that includes input fields for username and password, a login button, and options for remembering the user and canceling the action. It features styling for various elements, including buttons and modal animations, and includes JavaScript to handle modal display and closing functionality. The design is responsive, adapting to different screen sizes.

Uploaded by

Epic Games
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views3 pages

Modal Login Form Design Template

The document is an HTML code for a modal login form that includes input fields for username and password, a login button, and options for remembering the user and canceling the action. It features styling for various elements, including buttons and modal animations, and includes JavaScript to handle modal display and closing functionality. The design is responsive, adapting to different screen sizes.

Uploaded by

Epic Games
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial, Helvetica, sans-serif;}

/* 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;
}

/* 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;
}

/* Extra styles for the cancel button */


.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}

.container {
padding: 16px;
}

[Link] {
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: 60px;
}

/* 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: 80%; /* 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) {
[Link] {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
</head>
<body>

<h2>Modal Login Form</h2>

<button onclick="[Link]('id01').[Link]='block'"
style="width:auto;">Login</button>

<div id="id01" class="modal">

<form class="modal-content animate" action="/action_page.php">


<div class="imgcontainer">
<span onclick="[Link]('id01').[Link]='none'"
class="close" title="Close Modal">×</span>

<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>

<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>

<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>

<div class="container" style="background-color:#f1f1f1">


<button type="button"
onclick="[Link]('id01').[Link]='none'"
class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</div>

<script>
// Get the modal
var modal = [Link]('id01');

// When the user clicks anywhere outside of the modal, close it


[Link] = function(event) {
if ([Link] == modal) {
[Link] = "none";
}
}
</script>

</body>
</html>

You might also like