Spacing between letters

Hello! How can I stretch out the last word .eighteen so it covers the width of the container? I tried letter-spacing but then the word is moving off from text-align, and space-between and display flex did not work either. The desired look is the bottom word "Beck" (the artists name in this design). https://github.com/AMarlonG/Quote-by-the-artist-Beck/blob/main/assets/Beck-quote.jpg Repo: https://github.com/AMarlonG/Quote-by-the-artist-Beck I'm using container-type so it only works in chromium or safari, not firefox yet.
12 Replies
MarkBoots
MarkBoots2y ago
not yet, but almost. If im correct, chrome will add this feature to the first coming update. *never mind, im confused with another feature that will try to wrap text evenly
Jochem
Jochem2y ago
the only way I can think of now, would be to have each letter in its own element, and then putting display: flex; justify-content: space-between; on the parent you'd have to have the letters separated into spans or some other element though, it won't just work on the letters in a flex container
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Å Marlon G
Å Marlon GOP2y ago
That's what I thought, yes ... 🤔 Another day, another functionality which feels like CSS should have. But that's where progress comes in, hey. Thank you, people! 🙌
MarkBoots
MarkBoots2y ago
i was wondering why it didnt work with letterspacing, but i think it should (with a magic number though, ch so it responds to font-size)
Å Marlon G
Å Marlon GOP2y ago
Yep! It worked, with these magic numbers: .eighteen { font-size: 15cqw; letter-spacing: 3.05ch; padding-left: 0.26ch; } 😅 But, why does it work in a div, but not in a paragraph? Aren't both block level elements?
MarkBoots
MarkBoots2y ago
works for me in a <p> as well, but it is ugly af. I would still use the flex option (was just wondering)
Å Marlon G
Å Marlon GOP2y ago
Hmm... not for me. Changing it to <p> the spacing get all screwed up? Is that a thing – different internal spacing for different elements? <div> looks B E A utiful in my browser. Haha! 😂
Å Marlon G
Å Marlon GOP2y ago
Å Marlon G
Å Marlon GOP2y ago
I thought this was ment to prevent that? *, *::before, *::after { box-sizing: border-box; } * { margin: 0; padding: 0; font: inherit; }
MarkBoots
MarkBoots2y ago
maybe some artifacts from lineheight or something. don't know. but if it works, it works. Sometimes strange things happen, You could try to investigate were it comes from, but it takes time and most of the time it just is what it is, without an option to correct it
Å Marlon G
Å Marlon GOP2y ago
Doesn't seem to be line height, but I'm good with if it works, it works for this issue. Maybe even putting the letters in <span> gives more control, but it's not dynamic content, so this is it. I'm satisfied! Thanx! 👏
Want results from more Discord servers?
Add your server