I have a html code
tag, wrapped in in a pre
tag with fixed width and am getting ugly automatic line breaks:
What I want to achieve is, that the text is NOT automatically broken on spaces, but when I add a white-space: nowrap
to the code
element, the whole thing collapses to a single line, so all \n and \r characters are ignored as well:
Does anyone have an idea how to prevent automatic line breaks, but keep the intended line breaks?
The problem was caused by twitter bootstrap. For whatever reason, they added the following styles to the code tag:
white-space:pre;
white-space:pre-wrap;
word-break:break-all;
word-wrap:break-word;
By overwriting the styles with:
white-space: pre;
word-break: normal;
word-wrap: normal;
The problem was fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With