Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. <style id="jsbin-css">
  8. .wrapper {
  9. display: grid;
  10. grid-template-columns: 1fr 2fr 1fr;
  11. grid-auto-rows: minmax(100px, auto);
  12. grid-gap: 1em;
  13. justify-items: stretch;
  14. align-items: stretch;
  15. }
  16.  
  17. .wrapper > div {
  18. background: #eee;
  19. padding: 1em;
  20. }
  21.  
  22. .wrapper > div:nth-child(odd) {
  23. background: #ddd;
  24. }
  25.  
  26. .box1 {
  27. align-self: start;
  28. grid-column: 1/3;
  29. grid-row: 1/3;
  30.  
  31. }
  32. .box2 {
  33. align-self: end;
  34. grid-column: 3;
  35. grid-row: 1/3;
  36. }
  37.  
  38. .box3 {
  39. justify-self: end;
  40. grid-column:2/4;
  41. grid-row:3;
  42. }
  43.  
  44. .box4 {
  45. grid-column: 1;
  46. grid-row: 2/4;
  47. border: 1px solid #333;
  48. }
  49. </style>
  50. </head>
  51. <body>
  52. <div class="wrapper">
  53. <div class="box box1">Box 1</div>
  54. <div class="box box2">Box 2</div>
  55. <div class="box box3">Box 3</div>
  56. <div class="box box4">Box 4</div>
  57. </div>
  58.  
  59.  
  60.  
  61. <script id="jsbin-source-css" type="text/css">.wrapper {
  62. display: grid;
  63. grid-template-columns: 1fr 2fr 1fr;
  64. grid-auto-rows: minmax(100px, auto);
  65. grid-gap: 1em;
  66. justify-items: stretch;
  67. align-items: stretch;
  68. }
  69.  
  70. .wrapper > div {
  71. background: #eee;
  72. padding: 1em;
  73. }
  74.  
  75. .wrapper > div:nth-child(odd) {
  76. background: #ddd;
  77. }
  78.  
  79. .box1 {
  80. align-self: start;
  81. grid-column: 1/3;
  82. grid-row: 1/3;
  83.  
  84. }
  85. .box2 {
  86. align-self: end;
  87. grid-column: 3;
  88. grid-row: 1/3;
  89. }
  90.  
  91. .box3 {
  92. justify-self: end;
  93. grid-column:2/4;
  94. grid-row:3;
  95. }
  96.  
  97. .box4 {
  98. grid-column: 1;
  99. grid-row: 2/4;
  100. border: 1px solid #333;
  101. }
  102.  
  103. </script>
  104. </body>
  105. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement