I have a flexbox container that uses white-space: pre
formatting and contains some whitespace-only text nodes. However unless the whitespaces are wrapped in a span
these are not displayed. Why is this happening and could I make it work without using the extra spans?
(btw. I am using flexbox to make some other elements grow to full width of the container)
.container {
display: flex;
white-space: pre;
}
.red {
color: red;
}
.blue {
color: blue;
}
<div class="container">
<span> </span><span class="red">foo</span><span> </span><span class="blue">bar</span>
</div>
<div class="container">
<span class="red">foo</span> <span class="blue">bar</span>
</div>