How can I make the following text wrap in a natural way?
<li> 200g <a href="LINK"> Fullkornspasta </a> , spaghetti </li>
This is how the text currently wraps.
This is how I would like the text to wrap. Se the "," is on the first line.
2
div { resize: both; overflow: auto; background: #aaa; } .nowrap{ white-space: nowrap }
<div> <li> 200g <span class="nowrap"> <a href="LINK"> Fullkornspasta </a>, </span> spaghetti </li> </div>
so you wanted this result? I know it’s little hacky but I have no better solution for line breaks between elements.
Using several lines for text inside an HTML element can cause undesired effects, such as spaces. So it is better to make it one line. Compare these:
<li> 200g <a href="LINK"> Fullkornspasta </a> , spaghetti </li> <li> 200g <a href="LINK"> Fullkornspasta </a>, spaghetti </li> <li> 200g <a href="LINK">Fullkornspasta</a> , spaghetti </li> <li> 200g <a href="LINK">Fullkornspasta</a>, spaghetti </li> <li>200g <a href="LINK">Fullkornspasta</a>, spaghetti</li>
Click here to cancel reply.
2
Answers
so you wanted this result? I know it’s little hacky but I have no better solution for line breaks between elements.
Using several lines for text inside an HTML element can cause undesired effects, such as spaces. So it is better to make it one line. Compare these: