Advertisement
1xptolevitico69

CSS calc Function - responsive

Aug 21st, 2022
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.   <!-- Global site tag (gtag.js) - Google Analytics -->
  6.   <script async="" src="https://www.googletagmanager.com/gtag/js?id=G-420XFJRS1M"></script>
  7.   <script>
  8.     window.dataLayer = window.dataLayer || [];
  9.  
  10.     function gtag() {
  11.       dataLayer.push(arguments);
  12.     }
  13.     gtag('js', new Date());
  14.     gtag('config', 'G-420XFJRS1M');
  15.   </script>
  16.   <link rel="shortcut icon" href="https://1xpto.netlify.app/items/favicon.gif" type="image/x-icon">
  17.   <meta charset="UTF-8">
  18.   <meta http-equiv="X-UA-Compatible" content="IE=edge">
  19.   <meta name="keywords" content="CSS calc Function - responsive">
  20.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  21.   <title>CSS calc Function - responsive</title>
  22.  
  23.   <head>
  24.     <style>
  25.       .appsrc {
  26.         font-size: 10px;
  27.         z-index: 1;
  28.         text-decoration: none;
  29.         font-family: verdana;
  30.         font-weight: bold;
  31.         color: red;
  32.         position: absolute;
  33.         top: 0;
  34.         left: 0;
  35.         margin: 5px;
  36.         border: 2px solid red;
  37.         padding: 5px 10px;
  38.       }
  39.  
  40.       .app {
  41.         font-size: 10px;
  42.         z-index: 1;
  43.         text-decoration: none;
  44.         font-family: verdana;
  45.         font-weight: bold;
  46.         color: red;
  47.         position: absolute;
  48.         top: 0;
  49.         right: 0;
  50.         margin: 5px;
  51.         border: 2px solid red;
  52.         padding: 5px 10px;
  53.       }
  54.  
  55.       body {
  56.         margin: 0;
  57.         padding: 10px;
  58.       }
  59.  
  60.       button {
  61.         border: 0;
  62.         outline: 0;
  63.         background-color: white;
  64.       }
  65.  
  66.       body h1 {
  67.         text-align: center;
  68.         font-family: verdana;
  69.         font-size: 4vw;
  70.       }
  71.  
  72.       body button {
  73.         display: block;
  74.         margin: 5px 0;
  75.       }
  76.  
  77.       .btn1 img {
  78.         width: 100%;
  79.       }
  80.  
  81.       .btn1 {
  82.         position: relative;
  83.         left: 25%;
  84.         width: calc(100% - 50%);
  85.         border: 1px solid black;
  86.       }
  87.  
  88.       .div2 {
  89.         position: relative;
  90.         left: 20%;
  91.         width: calc(100% - 40%);
  92.         border: 1px solid black;
  93.         height: calc(80vw / 1.777);
  94.         padding: 5px;
  95.       }
  96.  
  97.       .div2 img {
  98.         width: 100%;
  99.         height: 100%;
  100.       }
  101.  
  102.       .btn2 {
  103.         position: relative;
  104.         left: 35%;
  105.         width: calc(100% - 70%);
  106.         border: 1px solid black;
  107.       }
  108.  
  109.       .btn2 p {
  110.         float: left;
  111.         text-align: justify;
  112.       }
  113.  
  114.       .div1 {
  115.         position: relative;
  116.         left: 10%;
  117.         width: calc(100% - 20%);
  118.         border: 1px solid;
  119.         height: calc(40vw / 1.777);
  120.         padding: 5px 0;
  121.       }
  122.  
  123.       .div1 img {
  124.         width: 49%;
  125.         height: 100%;
  126.         float: left;
  127.         margin: 0 0.5%;
  128.       }
  129.  
  130.       .btn3 {
  131.         position: relative;
  132.         width: calc(100% - 20%);
  133.         left: 10%;
  134.         border: 1px solid;
  135.         padding: 10px;
  136.       }
  137.  
  138.       .btn3 img {
  139.         width: 49.8%;
  140.       }
  141.  
  142.       /*         MEDIA        */
  143.       @media all and (orientation: portrait) and (max-width: 425px) {
  144.         body h1 {
  145.           font-size: 10vw;
  146.         }
  147.  
  148.         .btn1 {
  149.           left: 0;
  150.           width: calc(100%);
  151.           border: 1px solid black;
  152.         }
  153.  
  154.         .div2 {
  155.           left: 10%;
  156.           width: calc(100% - 20%);
  157.           border: 0;
  158.         }
  159.  
  160.         .btn2 {
  161.           left: 5%;
  162.           width: calc(100% - 10%);
  163.         }
  164.  
  165.         .btn3 img {
  166.           width: 100%;
  167.           margin: 2px 0;
  168.         }
  169.       }
  170.     </style>
  171.   </head>
  172.  
  173. <body>
  174.   <a class='app' href='https://1xpto.netlify.app/'>Visite Site</a>
  175.   <a class='appsrc' href='https://1xpto.netlify.app/posts/CSS calc Function - responsive/local/index.txt'>Source code</a>
  176.  
  177.   <h1>CSS calc Function - responsive</h1>
  178.  
  179.   <button class='btn1'>
  180.     <img src='https://1xpto.netlify.app/pic/5.jpg' />
  181.   </button>
  182.  
  183.   <div class='div2'>
  184.     <img src='https://1xpto.netlify.app/pic/3.jpg' />
  185.   </div>
  186.  
  187.   <button class='btn2'>
  188.     <p>Button, piece of solid material having holes or a shank through which it is sewed to one side of an article of clothing and used to fasten or close the garment by passing through a loop or hole in the other side. Purely decorative, non utilitarian buttons are also frequently used on clothing.</p>
  189.   </button>
  190.  
  191.   <div class='div1'>
  192.     <img src='https://1xpto.netlify.app/pic/8.jpg' />
  193.     <img src='https://1xpto.netlify.app/pic/9.jpg' />
  194.   </div>
  195.  
  196.   <button class='btn3'>
  197.     <img src='https://1xpto.netlify.app/pic/12.jpg' />
  198.     <img src='https://1xpto.netlify.app/pic/15.jpg' />
  199.   </button>
  200.  
  201.   <script>
  202.     history.scrollRestoration = "manual";
  203.     $(window).on('beforeunload', function() {
  204.       $(window).scrollTop(0);
  205.     });
  206.   </script>
  207. </body>
  208.  
  209. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement