Guest User

Untitled

a guest
Jan 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6.  
  7. <title>CSS Question</title>
  8.  
  9. <style type="text/css">
  10. .mystery,
  11. .mystery *
  12. {
  13. padding: 0;
  14. border: 0;
  15. margin: 0;
  16. }
  17.  
  18. .button-container
  19. {
  20. background-color: #f77;
  21. padding: 1rem;
  22. margin: 1rem;
  23. }
  24.  
  25. .button
  26. {
  27. float: left;
  28. font-family: 'Courier', monospace;
  29. width: 3.1rem;
  30. height: 2rem;
  31. border: solid black 2px;
  32. margin-right: 0.7rem;
  33. }
  34.  
  35. .button-wider-1
  36. {
  37. /*
  38. The following 'calc' expression adds up:
  39.  
  40. * the standard width of a button (i.e. the width
  41. of an element with class "button");
  42. * the width of a button's border;
  43. * the horizontal margin (i.e. the value of margin-right for a
  44. button);
  45. * the width of a button's border;
  46. */
  47. width: calc(
  48. 3.1rem +
  49. 2px +
  50. 0.7rem +
  51. 2px
  52. );
  53. }
  54.  
  55. .button-wider-2
  56. {
  57. /*
  58. The following 'calc' expression is the same as the previous,
  59. except that there is an extra term at the end, the standard width
  60. of a button.
  61. */
  62. width: calc(
  63. 3.1rem +
  64. 2px +
  65. 0.7rem +
  66. 2px +
  67. 3.1rem
  68. );
  69. }
  70. </style>
  71. </head>
  72.  
  73. <body>
  74. <div class="mystery">
  75. <div class="button-container">
  76. <button type="button" class="button">x</button>
  77. <button type="button" class="button">x</button>
  78. <div style="clear: both"></div>
  79. <button type="button" class="button button-wider-1">y</button>
  80. <div style="clear: both"></div>
  81. </div>
  82.  
  83. <div class="button-container">
  84. <button type="button" class="button">x</button>
  85. <button type="button" class="button">x</button>
  86. <div style="clear: both"></div>
  87. <button type="button" class="button button-wider-2">y</button>
  88. <div style="clear: both"></div>
  89. </div>
  90. </div>
  91. </body>
  92. </html>
Add Comment
Please, Sign In to add comment