运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到空间
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> :fullscreen { background-color: yellow; } /* Style the buttons */ button { padding: 10px; font-size: 15px; } </style> </head> <body> <h2>Fullscreen Mode</h2> <p>Click on the "Open Fullscreen" button to open this page in fullscreen mode. Close it by either clicking the "Esc" key on your keyboard, or with the "Close Fullscreen" button.</p> <button onclick="openFullscreen();">Open Fullscreen</button> <button onclick="closeFullscreen();">Close Fullscreen</button> <script> // Using JavaScript to open the page in fullscreen mode const elem = document.documentElement; function openFullscreen() { if (elem.requestFullscreen) { elem.requestFullscreen(); } } function closeFullscreen() { if (document.exitFullscreen) { document.exitFullscreen(); } } </script> </body> </html>