I have two divs with inline-block style, that both contains text with different font-sizes. They should be on the same line and then the second should break, but they are only if the second div is shorter then the body's width.
div {
display: inline-block;
font-family: Arial;
}
#a {
font-size: 30px;
margin-right: 50px;
}
#b {
/* No new line at b!! */
font-size: 40px;
}
<div id="a">Fruits:</div>
<div id="b">Banana (3), Apple (2), Kiwi (5), Orange (1), Pear (11)</div>
Here I illustrate the problem:
What it looks like:
Fruits:
Banana (3), Apple (2), Kiwi (5), Orange (1), Pear (11)
What it should look like:
Fruits: Banana (3), Apple (2), Kiwi (5),
Orange (1), Pear (11)
And again, one more example of what it shouldn't look like, but could if the div was inline:
Fruits: Banana (3), Apple (2), Kiwi (5),
Orange (1), Pear (11)
Is there anyway I can fix this?
I have tried using white-space: nowrap and word-wrap: break-word, but none of them seems to work.