not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
5.4 KiB

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>controlled inline: onyx toolbar design</title>
  5. <link href="../source/css/onyx.css" rel="stylesheet" type="text/css" />
  6. <style>
  7. /*
  8. the 'inline' class sets up a left-to-right container, with vertically centered children
  9. */
  10. .inline {
  11. white-space: nowrap;
  12. }
  13. .inline > * {
  14. display: inline-block;
  15. vertical-align: middle;
  16. }
  17. .icon {
  18. width: 32px;
  19. height: 32px;
  20. background-image: url(menu-icon-bookmark.png);
  21. }
  22. .bord {
  23. border: 1px solid lightblue;
  24. }
  25. .big {
  26. font-size: 48px;
  27. }
  28. .pad {
  29. padding: 8px;
  30. }
  31. .bg {
  32. background: orange;
  33. }
  34. /*
  35. We can control line-height so that vertical-align: middle
  36. becomes true center. Otherwise, when line-height is in effect
  37. (i.e. if the actual height is less than line height),
  38. user agents pad the line unevenly.
  39. */
  40. .lhc {
  41. line-height: 0;
  42. }
  43. /*
  44. Defeat line-height control above for children
  45. */
  46. .lhc > * {
  47. line-height: normal;
  48. }
  49. /*
  50. Enforce line-height 0 for an inline child of an inline (FIXME: fiddly)
  51. */
  52. .lhc .lhc {
  53. line-height: 0px;
  54. }
  55. /**/
  56. .h {
  57. height: 64px;
  58. }
  59. /*
  60. It's useful to be able to abut toolbars in an inline context
  61. and not worry about varying heights.
  62. Generally icons are the largest elements in a toolbar, and will
  63. drive the height to this size.
  64. We can't set a min-size directly on the toolbar because it
  65. breaks centering (due to interation with line-height).
  66. For some scenarios a developer may want to override the height value.
  67. */
  68. .stent {
  69. /*
  70. the point of the stent is to force the box height to some minimum, similar
  71. to line-height, but with proper vertical centering
  72. */
  73. height: 72px;
  74. /* the width is 0, but it adds some size to the inline because of ? */
  75. width: 0px;
  76. visibility: hidden;
  77. }
  78. .stent-fix {
  79. /* stent imparts mystery width to it's parent */
  80. /* setting font-size doesn't affect the mystery width */
  81. /*font-size: 0px;*/
  82. /* floating the stent prevents it from stenting */
  83. /*float: left;*/
  84. /* on non-mozilla, mystery size can be removed this way, but the actual pixels needed depends on font size */
  85. /*margin-right: -6px;*/
  86. /* on non-mozilla, this gets us within a few pixels for tested fonts */
  87. margin-right: -0.25em;
  88. }
  89. /* */
  90. .stenty > * {
  91. min-height: 56px;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <label>"inline" tests</label>
  97. <br /><br />
  98. <div>
  99. <label>combo content: when the text is larger than non-text objects, vertical centering goes wonky</label>
  100. <div class="inline bord big">
  101. <div>Text in Div</div>
  102. <input />
  103. <div class="icon"></div>
  104. </div>
  105. <br />
  106. <label>... it's possible to control line-height in such a way to repair centering</label>
  107. <div class="inline bord big lhc">
  108. <div>Text in Div</div>
  109. <input />
  110. <div class="icon"></div>
  111. </div>
  112. <br />
  113. <hr />
  114. <label>but now setting height or min-height on toolbar breaks centering</label>
  115. <div class="inline bord lhc bg big h">
  116. <div>Text in Div</div>
  117. <input />
  118. <div class="icon"></div>
  119. </div>
  120. <br />
  121. <div class="inline bord big lhc">
  122. <div class="inline bord lhc bg h">
  123. <div>Text in Div</div>
  124. <input />
  125. <div class="icon"></div>
  126. </div>
  127. <div class="inline bord lhc bg h">
  128. <input />
  129. <div class="icon"></div>
  130. </div>
  131. </div>
  132. <br />
  133. <hr />
  134. <label>control height on children instead of toolbar</label>
  135. <div class="inline bord big lhc">
  136. <div class="inline bord lhc bg">
  137. <div>Text in Div</div>
  138. <input />
  139. <div class="icon"></div>
  140. </div>
  141. <div class="inline bord lhc bg">
  142. <input />
  143. <div class="icon"></div>
  144. </div>
  145. </div>
  146. <br />
  147. <div class="inline bord big lhc">
  148. <div class="inline bord lhc bg stenty">
  149. <div>Text in Div</div>
  150. <input />
  151. <div class="icon"></div>
  152. </div>
  153. <div class="inline bord lhc bg stenty">
  154. <input />
  155. <div class="icon"></div>
  156. </div>
  157. </div>
  158. <br />
  159. <hr />
  160. <label>it's possible to use a stent to effect min-height, but for unknown reasons, even a 0-width stent affects parent width</label>
  161. <div class="inline bord big lhc">
  162. <div class="inline bord lhc bg">
  163. <div>Text in Div</div>
  164. <input />
  165. <div class="icon"></div>
  166. </div>
  167. <div class="inline bord lhc bg">
  168. <input />
  169. <div class="icon"></div>
  170. </div>
  171. </div>
  172. <br />
  173. <div class="inline bord big lhc">
  174. <div class="inline bord lhc bg">
  175. <div class="stent"></div>
  176. <div>Text in Div</div>
  177. <input />
  178. <div class="icon"></div>
  179. </div>
  180. <div class="inline bord lhc bg">
  181. <div class="stent"></div>
  182. <input />
  183. <div class="icon"></div>
  184. </div>
  185. </div>
  186. <br />
  187. <label>using img as stent node makes no difference</label>
  188. <div class="inline bord big lhc">
  189. <div class="inline bord lhc bg">
  190. <img class="stent" />
  191. <div>Text in Div</div>
  192. <input />
  193. <div class="icon"></div>
  194. </div>
  195. <div class="inline bord lhc bg">
  196. <img class="stent" />
  197. <input />
  198. <div class="icon"></div>
  199. </div>
  200. </div>
  201. <br />
  202. <label>using negative margin on stent can approximate 0 width</label>
  203. <div class="inline bord big lhc">
  204. <div class="inline bord lhc bg">
  205. <div class="stent stent-fix"></div>
  206. <div>Text in Div</div>
  207. <input />
  208. <div class="icon"></div>
  209. </div>
  210. <div class="inline bord lhc bg">
  211. <div class="stent stent-fix"></div>
  212. <input />
  213. <div class="icon"></div>
  214. </div>
  215. </div>
  216. <br />
  217. </div>
  218. </body>
  219. </html>