Cara Membuat Login Form top up HTML,CSS, JavaScript

kali ini saya akan membagikan cara membuat Login Form top up

1). Pertama Tambahkan HTML
<button onclick="document.getElementById('id01').style.display='block'">Login</button>

<div id="id01" class="modal">
  <span onclick="document.getElementById('id01').style.display='none'"
class="close" title="Close Modal">&times;</span>

  <form class="modal-content animate" action="/action_page.php">
    <div class="imgcontainer">
      <img src="img_avatar2.png" alt="Avatar" class="avatar">

    <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>
        <input type="checkbox" checked="checked" name="remember"> Remember me

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

2). Tambahkan CSS
.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: 5px auto;
  border: 1px solid #888;
  width: 80%;

.close {
  position: absolute;
  right: 25px;
  top: 0;
  color: #000;
  font-size: 35px;
  font-weight: bold;

.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)}

3). Terakhir Tambahkan JavaScript
var modal = document.getElementById('id01');

window.onclick = function(event) {
  if ( == modal) { = "none";

Posting Komentar untuk "Cara Membuat Login Form top up HTML,CSS, JavaScript"