Text-Align: Justify; Hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p class="month"><span class="name">July</span> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31<span class="break">hi</span></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.month { | |
text-align: justify; | |
.break { | |
display: inline-block; | |
width: 100%; | |
color: transparent; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
text-align: justify;
hack is pretty smart. It allows you to justify the text of an inline element given whatever width it's served. It's flexy. Here's the article that Barrel NY put out about it. And here's an example of how I'm using it to justify the days of the month on this calendar-type-thing:When I change the width of the element, the space between words automagically evens out. Which is coincidentally super useful if I wanted to change the number of days in the month/ alternate without hand coding spans around each date.
Automate all the things!