Advertisement
1xptolevitico69

Custom media queries (Mobile Only)

Jan 5th, 2022
686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.40 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.   <meta charset="UTF-8">
  6.   <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.   <title>Custom media queries (Mobile Only)</title>
  9.   <style>
  10.  
  11.     .clone {
  12.       position: absolute;
  13.       top: 10px;
  14.       left: 10px;
  15.       text-decoration: none;
  16.       background-color: white;
  17.       width: 150px;
  18.       text-align: center;
  19.       color: red;
  20.       font-family: arial black;
  21.       padding: 5px 20px;
  22.     }
  23.  
  24.     .sub_clone {
  25.       position: absolute;
  26.       top: 50px;
  27.       left: 10px;
  28.       text-decoration: none;
  29.       background-color: white;
  30.       width: 150px;
  31.       text-align: center;
  32.       color: red;
  33.       font-family: arial black;
  34.       padding: 5px 20px;
  35.     }
  36.  
  37.  
  38.  
  39.     body {
  40.       margin: 0;
  41.       overflow: hidden;
  42.     }
  43.  
  44.     .desktop {
  45.       background-color: red;
  46.       width: 100%;
  47.       height: 100vh;
  48.       position: absolute;
  49.       display: none;
  50.     }
  51.  
  52.     .desktop h1 {
  53.       font-family: verdana;
  54.       text-align: center;
  55.       color: white;
  56.       font-size: 100px;
  57.       margin-top: 200px;
  58.     }
  59.  
  60.     .media h1 {
  61.       font-family: courier;
  62.       text-align: center;
  63.       color: red;
  64.       font-size: 50px;
  65.     }
  66.  
  67.     #media {
  68.       position: absolute;
  69.       top: 0px;
  70.       left: 0;
  71.       width: 100%;
  72.       height: 100vh;
  73.       display: none;
  74.     }
  75.  
  76.     img {
  77.       width: 80%;
  78.       margin: 20px auto;
  79.       display: block;
  80.     }
  81.  
  82.     video {
  83.       width: 80%;
  84.       margin: auto;
  85.       display: block;
  86.       transform-origin: center top;
  87.       transform: scaleY(1.5);
  88.       padding-bottom: 20px;
  89.     }
  90.  
  91.     #bt {
  92.       width: 30px;
  93.       height: 30px;
  94.       border-radius: 50%;
  95.       position: fixed;
  96.       right: 0;
  97.       top: 0;
  98.       margin: 10px;
  99.     }
  100.  
  101.     #bt_menu {
  102.       width: 30px;
  103.       height: 30px;
  104.       border-radius: 50%;
  105.       position: absolute;
  106.       right: 0;
  107.       top: 0;
  108.       margin: 10px;
  109.     }
  110.  
  111.     #menu {
  112.       position: absolute;
  113.       top: 0px;
  114.       left: 0;
  115.       width: 100%;
  116.       height: 100vh;
  117.       display: none;
  118.       box-sizing: border-box;
  119.       background-color: olive;
  120.       padding-top: 40px;
  121.     }
  122.  
  123.     .link {
  124.       margin: 5px 0;
  125.       text-decoration: none;
  126.       display: block;
  127.       color: white;
  128.       font-family: verdana;
  129.       font-size: 16px;
  130.       padding: 5px 10px;
  131.       font-weight: 900;
  132.       background-color: red;
  133.     }
  134.  
  135.     @media all and (max-width:425px) {
  136.       #media {
  137.         display: block;
  138.         overflow-Y: scroll;
  139.       }
  140. .clone{display:none;}
  141. .sub_clone{display:none;}
  142.     }
  143.  
  144.     @media all and (min-width: 426px) and (max-width: 538px) and (orientation: landscape) {
  145.       #media {
  146.         display: block;
  147.         overflow-Y: scroll;
  148.       }
  149. .clone{display:none;}
  150. .sub_clone{display:none;}
  151.     }
  152.  
  153.     @media all and (min-width: 824px) {
  154.       .desktop {
  155.         display: block;
  156.       }
  157.     }
  158.   </style>
  159. </head>
  160.  
  161. <body id='bd'>
  162.  
  163.   <section id='desktop' class='desktop'>
  164.     <h1>Mobile Only</h1>
  165.   </section>
  166.  
  167.   <section id='menu' class='menu'>
  168.     <button id='bt_menu'></button>
  169.     <a class='link' href='https://codepen.io/manuel-andrade/pen/GRMxLyV'>Javascript HTML5 video autoplay fullscreen
  170.     </a>
  171.     <a class='link' href='https://codepen.io/manuel-andrade/pen/VwMxWvP'>Anonymous function javascript
  172.     </a>
  173.   </section>
  174.  
  175.   <section id='media' class='media'>
  176.     <button id='bt'></button>
  177.     <img src='https://1xpto.netlify.app/pics/cat.gif' />
  178.     <h1 class='lazy'>Lazy <br> Cat</h1>
  179.     <video id='video' autoplay muted loop src='https://1xpto.netlify.app/video/video.mp4'></video>
  180.   </section>
  181.  
  182.   <a id='clone' class='clone' title="Subscribe and hit the notification bell for more updates. It's free." href='https://www.youtube.com/channel/UCqLpDK0eOsG1eEeF9jOUZkw'>SUBSCRIBE</a>
  183.  
  184.   <a id='sub_clone' class='sub_clone' href='https://1xpto.netlify.app/video/video sample02.mp4'>VIDEO SAMPLE</a>
  185.  
  186.  
  187.  
  188.  
  189.  
  190.   <script>
  191.     bt.onclick = () => {
  192.       media.style.display = 'none';
  193.       menu.style.display = 'block';
  194.       menu.style.zIndex = '-1';
  195.     }
  196.     bt_menu.onclick = () => {
  197.       media.style.display = 'block';
  198.       menu.style.display = 'none';
  199.       desktop.style.zIndex = '1';
  200. clone.style.zIndex = '1';
  201. sub_clone.style.zIndex = '1';
  202.     }
  203.   </script>
  204. </body>
  205.  
  206. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement