Okay, I've got 3 variables, StringA, StringB, StringC. StringA and StringB combine to link to an external page.
By default, all 3 elements are on the same line:
StringA StringB StringC
When one of them is too long for the space, they need to wrap in a way that leaves StringA on the first line:
StringA
StringB StringC
When more wrapping is needed, then:
StringA
StringB
StringC
My current code looks something like this (with flex happening at a higher level):
<span class="container">
<a class="link">
<span class="string-a">{{stringA}} </span>
<span class="string-b">{{stringB}}</span>
</a>
<span class="string-c">{{stringC}}</span>
</span>
And the CSS:
.container {
.string-b {
white-space: nowrap;
}
.string-c {
white-space: nowrap;
}
}
This gets me most of the way there, but it makes a "smart" choice on whether to wrap between A and B or between B and C, and I need it to always wrap between A and B as the first choice and only wrap between B and C if A and B are already wrapped.
Presumably, there's a way to use flexbox to solve this, but I've tried a whole bunch of things and keep failing. Having to restore to JS to do it would be pretty ugly.