Advertisement
_AMDG_

rwd-flex example

Jun 21st, 2018
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.74 KB | None | 0 0
  1. /* RWD-Flex */
  2. /* Copyright 2018 Andrew Porter */
  3.  
  4. * {
  5.     box-sizing: border-box;
  6. }
  7.  
  8. :root {
  9.     width: 100%;
  10.     height: 100%;
  11. }
  12.  
  13. body {
  14.     display: -webkit-flex;
  15.     display: -webkit-box;
  16.     display: -ms-flexbox;
  17.     display: flexbox;
  18.     display: flex;
  19.    
  20.     margin: 0;
  21.     min-width: inherit;
  22.     min-height: inherit;
  23.     width: auto;
  24.     height: auto;
  25.  
  26.     flex-flow: column nowrap;
  27. }
  28.  
  29. /* Desktop */
  30. @media only screen and (min-width: 768px){
  31.  
  32.     .row {
  33.         display: -webkit-flex;
  34.         display: -webkit-box;
  35.         display: -ms-flexbox;
  36.         display: flexbox;
  37.         display: flex;
  38.         flex-flow: row nowrap;
  39.     }
  40.    
  41.     .row.reverse {
  42.         flex-direction: row-reverse;
  43.     }
  44.    
  45.     .column {
  46.         display: -webkit-flex;
  47.         display: -webkit-box;
  48.         display: -ms-flexbox;
  49.         display: flexbox;
  50.         display: flex;
  51.         flex-flow: column nowrap;
  52.     }
  53.    
  54.     .column.reverse {
  55.         flex-direction: column-reverse;
  56.     }
  57.    
  58.     .wrap {
  59.         flex-wrap: wrap;
  60.     }
  61.    
  62.     .wrap-reverse {
  63.         flex-wrap: wrap-reverse;
  64.     }
  65.    
  66.     div.image {
  67.         min-width: 0;
  68.         min-height: 0;
  69.     }
  70.    
  71.     div.image > img {
  72.         max-width: 100%;
  73.         max-height: 100%;
  74.         height: auto;
  75.     }
  76.  
  77.     img {
  78.         object-fit: contain;
  79.         -webkit-object-fit: contain;
  80.         -o-object-fit: contain;
  81.     }
  82.    
  83.     .dummy {
  84.         flex: 1 0 auto;
  85.         visibility: hidden;
  86.     }
  87.  
  88. }
  89.  
  90. /* Mobile */
  91. @media only screen and (max-width: 768px) {
  92.    
  93.     .row {
  94.         display: -webkit-flex;
  95.         display: flex;
  96.         flex-flow: row wrap;
  97.         width: 100%;
  98.         flex: 0 0 auto;
  99.     }
  100.    
  101.     .column {
  102.         flex: 0 1 auto;
  103.         flex-grow: 1;
  104.     }
  105.    
  106.     div.image {
  107.         min-width: 0;
  108.         min-height: 0;
  109.     }
  110.  
  111.     div.image > img {
  112.         max-width: 100%;
  113.         max-height: 100%;
  114.         height: auto;
  115.     }
  116.  
  117.     img {
  118.         object-fit: contain;
  119.         -webkit-object-fit: contain;
  120.         -o-object-fit: contain;
  121.     }
  122.    
  123.     .dummy {
  124.         display: none;
  125.     }
  126.    
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement