069-inline-flex-tail.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>069 inline-flex tail</title>
  6. <style>
  7. body { background: #ffffff; color: #202020; font-family: sans-serif;
  8. margin: 12px; font-size: 18px; }
  9. p { width: 600px; line-height: 24px; margin: 0 0 8px 0; }
  10. #a { background: #e0e0ff; }
  11. #b { background: #e0ffe0; }
  12. .more { display: inline-flex; align-items: center; font-weight: bold;
  13. color: #0050a0; }
  14. #result { background: #ffc8c8; color: #000000; padding: 8px;
  15. margin-top: 12px; }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>069 &mdash; inline-flex tail</h1>
  20. <p>An <code>inline-flex</code> span with only text continues the line, like
  21. an inline-block (news teasers end their text with one).</p>
  22. <p id="a">Short teaser text. <span class="more">more</span></p>
  23. <p id="b">Short teaser text. <b style="color:#0050a0">more</b></p>
  24. <div id="result">checking...</div>
  25. <script>
  26. setTimeout(function () {
  27. function R(id) { return document.getElementById(id).getBoundingClientRect(); }
  28. var a = R('a'), b = R('b');
  29. var ok = Math.abs(a.height - b.height) <= 2 && a.height < 40;
  30. var r = document.getElementById('result');
  31. if (r) {
  32. r.style.background = ok ? '#c8f0c8' : '#ffc8c8';
  33. r.textContent = (ok ? 'INLFLEX-OK ' : 'INLFLEX-FAIL ') + 'a=' +
  34. Math.round(a.height) + ' b=' + Math.round(b.height);
  35. }
  36. }, 300);
  37. </script>
  38. </body>
  39. </html>