It seems Chrome is wrapping an inline-block element if it is at the end of a line even if there is a white-space:pre container around it with overflow: auto. Is there a workable solution to prevent this from happening without changing the content?
<div style="width:400px;height:200px;overflow:auto;white-space:pre">
The span should be at the end of this text, however, it wraps to the next line.<span style="width:1px;display:inline-block;height:1em;background:red"></span>
</div>
The white-space must be preserved using newlines at least. Spaces and tabs may be compressed.
From stackoverflow
-
Try changing your white-space setting to
white-space: nowrap
instead.bmeck : This does prevent the span from wrapping, however it takes away the whitespace preservation used by the white-space: pre.Steve Danner : Would it work to change the white-space setting in your div style and to wrap the inner text with atag?
0 comments:
Post a Comment