• impedans@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      edit-2
      1 month ago

      If you define what you mean by centering I’ll give you a straight answer.

      Vertically? Horizontally? Center the text or the entire box? Compared to the viewport, the parent container or the entire page?

      “Centering” isn’t as straight forward as you’d think, and what you actually want usually depends on the situation.

        • impedans@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          1 month ago

          Yeah that works if you wanna center a box of content it relative to the parent container, either horizontally or vertically. For other situations we’ve got different tools

      • Schadrach@lemmy.sdf.org
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 month ago

        Fuck it, align=‘center’. That’ll center it horizontally relative to some context and if that’s not good enough then you should have been more precise in your request.

    • Blackmist@feddit.uk
      link
      fedilink
      English
      arrow-up
      9
      ·
      1 month ago

      Depends if you’re centering the div or the things in the div. Which has probably been the main issue since CSS was invented.

    • letsgo@lemm.ee
      cake
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 month ago

      Same way you did it in 2024 but it’s easier because the springgirdles have been replaced with rotated manglebrackets.