Untitled

 avatar
unknown
plain_text
5 months ago
1.6 kB
6
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Custom Alert Box</title>
  <style>
    /* Style for the overlay */
    .overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.5);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 1000;
    }

    /* Style for the alert box */
    .alert-box {
      background-color: white;
      padding: 20px;
      border-radius: 5px;
      width: 500px;
      text-align: center;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
	      max-height: 500px;
    overflow: auto;
    }

    /* Style for the button */
    .alert-box button {
      margin-top: 20px;
      padding: 10px 20px;
      background-color: #4CAF50;
      color: white;
      border: none;
      cursor: pointer;
    }

    .alert-box button:hover {
      background-color: #45a049;
    }
  </style>
</head>
<body>

<button onclick="showCustomAlert()">Show Alert</button>

<!-- Custom Alert HTML -->
<div id="customAlert" class="overlay" style="display:none;">
  <div class="alert-box">
    <p>This is a custom alert box!</p>
    <button onclick="hideCustomAlert()">OK</button>
  </div>
</div>

<script>
  // Function to show the custom alert
  function showCustomAlert() {
    document.getElementById('customAlert').style.display = 'flex';
  }

  // Function to hide the custom alert
  function hideCustomAlert() {
    document.getElementById('customAlert').style.display = 'none';
  }
</script>

</body>
</html>
Editor is loading...
Leave a Comment