box_sizing.rml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <rml>
  2. <head>
  3. <title>Box-sizing property</title>
  4. <link type="text/rcss" href="../style.rcss"/>
  5. <link rel="help" href="https://drafts.csswg.org/css-ui-3/#box-sizing" />
  6. <meta name="Description" content="Box-sizing property." />
  7. <style>
  8. div > div {
  9. width: 50%;
  10. margin: 10dp 0;
  11. padding: 20dp;
  12. border: 10dp #999;
  13. background-color: #aaf;
  14. }
  15. .border-box {
  16. background-color: #aea;
  17. box-sizing: border-box;
  18. }
  19. .float {
  20. float: left;
  21. }
  22. .margin {
  23. width: 23.3%; /* width + margins should be 33.3% */
  24. margin-left: 5%;
  25. margin-right: 5%;
  26. border-width: 20dp;
  27. }
  28. .fill {
  29. height: 200dp;
  30. border: 15dp #ffa;
  31. background: #f00;
  32. overflow: auto;
  33. }
  34. .fill > div {
  35. width: 100%;
  36. height: 50%;
  37. margin: 0 auto;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <p>Setting the 'box-sizing' property on elements using the same width and height.</p>
  43. <div>
  44. <div>box-sizing: content-box</div>
  45. <div class="border-box">box-sizing: border-box</div>
  46. </div>
  47. <hr/>
  48. <p>The following boxes should line up side-by-side.</p>
  49. <div>
  50. <div class="border-box float"/>
  51. <div class="border-box float"/>
  52. </div>
  53. <hr/>
  54. <div>
  55. <div class="margin border-box float"/>
  56. <div class="margin border-box float"/>
  57. <div class="margin border-box float"/>
  58. </div>
  59. <hr/>
  60. <p>There should be no scrollbars, and no red visible.</p>
  61. <div class="fill">
  62. <div class="border-box"/>
  63. <div class="border-box"/>
  64. </div>
  65. </body>
  66. </rml>