006-flex-grid.html 1.5 KB

123456789101112131415161718192021
  1. <!doctype html>
  2. <html><head><meta charset="utf-8"><title>006 flex and grid</title>
  3. <style>
  4. html,body{margin:0;padding:0;background:#fff;color:#202020;font-family:sans-serif;font-size:13px}
  5. h1{font-size:20px;margin:10px 0 4px 10px}p{margin:0 0 10px 10px}
  6. .pane{float:left;width:440px;margin-left:10px}.label{background:#eee;padding:4px 6px;margin-bottom:4px}
  7. .stage{background:#fff;padding:8px;border:1px solid #999}
  8. .flex{display:flex;width:400px;height:60px}.f1{background:#cc3333;flex-grow:1}.f2{background:#22aa44;flex-grow:2}.f3{background:#2244cc;flex-grow:1}
  9. .grid{display:grid;grid-template-columns:100px 200px;gap:10px;margin-top:10px}.g{height:40px;background:#cccccc}
  10. </style></head><body>
  11. <h1>006 &middot; flex and grid</h1>
  12. <p>Flex items must grow 1:2:1; the grid must have two columns.</p>
  13. <div class="pane"><div class="label">A: flex + grid</div><div class="stage">
  14. <div class="flex"><div class="f1"></div><div class="f2"></div><div class="f3"></div></div>
  15. <div class="grid"><div class="g"></div><div class="g"></div></div>
  16. </div></div>
  17. <div class="pane"><div class="label">B: float reference</div><div class="stage">
  18. <div style="width:400px;height:60px"><div class="f1" style="float:left;width:100px;height:60px"></div><div class="f2" style="float:left;width:200px;height:60px"></div><div class="f3" style="float:left;width:100px;height:60px"></div></div>
  19. <div style="width:400px;margin-top:10px"><div class="g" style="float:left;width:100px"></div><div class="g" style="float:left;width:200px;margin-left:10px"></div></div>
  20. </div></div>
  21. </body></html>