I just spent a fair bit of time figuring this out and thought I’d document it in case someone else is looking for the same thing.
What I wanted to do was center some text if there was only one line, but left-align it if the text spilled over to a second (or more) line:
After going down a bit of a rabbit hole w/r/t ::first-line and :text-align-last, and even considering employing some JavaScript, I realized there’s actually a pretty vanilla way of achieving the effect:
div.parent { text-align: center; } p.child { display: inline-block; clear: both; margin: 0 auto; text-align: left; }