So, I have two div's, right one containing vertical Chinese text, left one - corresponding English translation:
<div class="row">
<div class="col-left">
The Master said, "Is it not pleasant to learn with a constant perseverance and application? Is it not delightful to have friends coming from distant quarters? Is he not a man of complete virtue, who feels no discomposure though men may take no note of him?"
<div class = "col-right">
Chinese text is supposed to go here, but StackOverflow blocks posts with too much Chinese characters as spam...
</div>
</div>
and the following css:
.row {
display: flex;
flex-direction: row;
}
.col-left {
flex: 2;
}
.col-right {
flex: 1;
writing-mode: vertical-rl;
text-orientation: upright;
}
I want the left one to be as high as necessary to fit the text, while the right one to be only as high as the left one, to achieve the following result:
Making the layout height match the highest div won't do, this way the vertical text will just run in a single column:
So it boils down to the following:
- Left div stretches as much as needed
- Right div's height is set to the left div's
- Things don't work the other way around (i.e. the height must seem fixed from the right div's perspective, it mustn't stretch)
It's easy to do with JS, but I wonder if there's a pure CSS solution.