023-calc.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>023 calc</title>
  6. <style>
  7. html, body { margin: 0; padding: 0; background: #ffffff; color: #202020; }
  8. body { font-family: sans-serif; font-size: 13px; }
  9. h1 { font-size: 20px; margin: 10px 0 4px 10px; }
  10. p { margin: 0 0 10px 10px; }
  11. .pane { float: left; width: 440px; margin-left: 10px; }
  12. .label { background: #eeeeee; padding: 4px 6px; margin-bottom: 4px; }
  13. .stage { background: #ffffff; padding: 8px; border: 1px solid #999999; }
  14. .red { background: #cc3333; height: 40px; }
  15. .after { background: #333333; color: #ffffff; height: 24px; margin-top: 8px; padding-left: 4px; }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>023 &middot; calc()</h1>
  20. <p>The red box must be 191 px wide in both panes (422px stage minus 20px).</p>
  21. <div class="pane">
  22. <div class="label">A: width: calc(50% - 20px)</div>
  23. <div class="stage">
  24. <div class="red" style="width: calc(50% - 20px)"></div>
  25. <div class="after">after</div>
  26. </div>
  27. </div>
  28. <div class="pane">
  29. <div class="label">B: width: 191px</div>
  30. <div class="stage">
  31. <div class="red" style="width: 191px"></div>
  32. <div class="after">after</div>
  33. </div>
  34. </div>
  35. </body>
  36. </html>