‹ BackHN Continuity

Thread

Better Icon and Label Alignment

43 points · 8 comments · eustoria

Loading the complete thread in the background. This saved snapshot is available now. Refresh

  1. gfat · · focus · HN ↗
    Recently found the lh unit approach. It’s elegant for centering icons along the first line in dynamic, sometimes wrapping text.
  2. pveierland · · focus · HN ↗
    There's new CSS capabilities [0] that can help solve this problem better now via alignment-baseline [1] and text-box-trim [2].

    [0] <a href="https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;css-inline-3&#x2F;#leading-trim" rel="nofollow">https:&#x2F;&#x2F;www.w3.org&#x2F;TR&#x2F;css-inline-3&#x2F;#leading-trim

    [1] <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;Reference&#x2F;Properties&#x2F;alignment-baseline" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;Reference&#x2F;P...

    [2] <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;Reference&#x2F;Properties&#x2F;text-box-trim" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;CSS&#x2F;Reference&#x2F;P...

  3. lenkite · · focus · HN ↗
    God, this was so complicated to understand just to get an icon aligned properly with multi-line text. Someone needs to re-design CSS from scratch. Its has become a rube goldberg machine of complexity.
  4. LinguaBrowse · · focus · HN ↗
    &gt; In this solution, if you change any of the three values, the alignment will just work.

    … Except in Safari.

    It&#x27;s a disappointment – I was really hoping to come away with an elegant solution to this problem that&#x27;s cropped up so often during my career, but it doesn&#x27;t give me much faith in the author&#x27;s web layout course if they don&#x27;t test on the one rendering engine that all iOS users are stuck with.

  5. LinguaBrowse · · focus · HN ↗
    Playing around with the demos, none of the solutions seem very centred at all?

    I think the lh unit is surely part of the puzzle, but something more is needed. It assumes that the ascent and descent are symmetrical, for one thing.

  6. systoll · · focus · HN ↗
    [delayed]
  7. echoangle · · focus · HN ↗
    Is it weird that I like the version where the icon is centered on the multiple lines?
    1. zulux · · focus · HN ↗
      If they were just objects, indeed it would look better from a visual standpoint.

      I think it would drive most of your fellow humans nuts. My hunch is that people read the bullets as sentence markers, not just a visual flourish.

      1. jhbggjnjih · · focus · HN ↗
        Yes, that’s pretty much the function of bullet points, visually speaking.

        Visual hierarchy is a thing and when you have 3 icons next to single lines, you by default expect the all to follow the same pattern, cratering the icon vertically next to multi line text breaks the established visual pattern.

        Author even did some bad things such as expanding the circle radius way too outside the x-height so the emphasis lies strictly on the circle, when it should be on the line… but anyways.

  8. dcrazy · · focus · HN ↗

    [dead]

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.