<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Fullscreen Example</title>
  <style>
    body, html {
      margin: 0;
      padding: 0;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: #f0f0f0;
      font-family: Arial, sans-serif;
    }

    /* Fullscreen Button */
    #fullscreen-btn {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      padding: 15px 30px;
      font-size: 18px;
      background-color: #007bff;
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    }

    /* Hide the button when active */
    #fullscreen-btn.hidden {
      display: none;
    }
  </style>
</head>
<body>

  <button id="fullscreen-btn">Go Fullscreen</button>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      const fullscreenBtn = document.getElementById('fullscreen-btn');

      // Function to toggle fullscreen mode
      function openFullscreen() {
        const docElement = document.documentElement;
        if (docElement.requestFullscreen) {
          docElement.requestFullscreen();
        } else if (docElement.mozRequestFullScreen) { // Firefox
          docElement.mozRequestFullScreen();
        } else if (docElement.webkitRequestFullscreen) { // Chrome, Safari and Opera
          docElement.webkitRequestFullscreen();
        } else if (docElement.msRequestFullscreen) { // IE/Edge
          docElement.msRequestFullscreen();
        }
      }

      // Add event listener to the button
      fullscreenBtn.addEventListener('click', function() {
        openFullscreen();
        fullscreenBtn.classList.add('hidden'); // Hide the button after entering fullscreen
      });
    });
  </script>

</body>
</html>
