Last active
March 6, 2023 06:03
-
-
Save obsoke/e2d03f74e53509e34b7a9ad2a1638435 to your computer and use it in GitHub Desktop.
DIV vs DIALOG Fullscreen Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html class="no-js" lang=""> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="x-ua-compatible" content="ie=edge"> | |
| <title>Dialog Test</title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="apple-touch-icon" href="/apple-touch-icon.png"> | |
| <!-- Place favicon.ico in the root directory --> | |
| <style type="text/css" media="screen"> | |
| .dialog-container { | |
| position: absolute; | |
| } | |
| dialog { | |
| position: fixed; | |
| margin: 0; | |
| /* padding: 0; */ | |
| width: 100%; | |
| height: 100vh; | |
| border: 3px solid green; | |
| } | |
| .margin-container { | |
| margin: -16px; | |
| } | |
| .content { | |
| margin: 6px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| document.addEventListener('DOMContentLoaded', () => { | |
| const modal = document.querySelector('dialog'); | |
| const btn = document.querySelector('#opener'); | |
| btn.addEventListener('click', () => { | |
| modal.showModal(); | |
| }); | |
| }) | |
| </script> | |
| <!--[if lt IE 8]> | |
| <p class="browserupgrade"> | |
| You are using an <strong>outdated</strong> browser. Please | |
| <a href="http://browsehappy.com/">upgrade your browser</a> to improve | |
| your experience. | |
| </p> | |
| <![endif]--> | |
| <button id="opener">Open modal</button> | |
| <div class="dialog-container"> | |
| <dialog> | |
| <div class="margin-container"> | |
| <div class="content"> | |
| Hi | |
| </div> | |
| </div> | |
| </dialog> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html class="no-js" lang=""> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="x-ua-compatible" content="ie=edge"> | |
| <title>DIV Test</title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="apple-touch-icon" href="/apple-touch-icon.png"> | |
| <!-- Place favicon.ico in the root directory --> | |
| <style type="text/css" media="screen"> | |
| .dialog-container { | |
| position: absolute; | |
| } | |
| .dialog { | |
| position: fixed; | |
| margin: 0; | |
| padding: 0; | |
| /* width: 100%; | |
| height: 100vh; */ | |
| border: 3px solid green; | |
| top: 0; | |
| left: 0; | |
| bottom: 0; | |
| right: 0; | |
| } | |
| .content { | |
| margin: 6px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <!--[if lt IE 8]> | |
| <p class="browserupgrade"> | |
| You are using an <strong>outdated</strong> browser. Please | |
| <a href="http://browsehappy.com/">upgrade your browser</a> to improve | |
| your experience. | |
| </p> | |
| <![endif]--> | |
| <div class="dialog-container"> | |
| <div class="dialog"> | |
| <div class="margin-container"> | |
| <div class="content"> | |
| Hi | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment