Reputation: 17498
I have an asp:label that must fit in it's parent container
Problem is sometimes the text is one continuous sequence of characters with no white space.
I am looking for CSS behavior to break the word when the word is too long, but not break small sized words that can be shifted to the line below it.
This is what I originally had:
<asp:Label ID="lblTextComments" runat="server"></asp:Label>
This yields:
some normal text that
breaks onto a new line
But this happens with a long word:
someverylongtextwithoutanywhitespaceatalldoesnotcausealinebreaktohappen
This runs off the web page.
I've used this CSS style solution:
<asp:Label ID="lblTextComments" runat="server" Style="word-wrap: normal; word-break: break-all;" ></asp:Label>
This correctly breaks the long word:
someverylongtextwithoutanywh
itespaceatalldoesnotcauseali
nebreaktohappen
But this breaks small words that I wish to be moved to the next line:
some normal text tha
t breaks onto a new line
Upvotes: 0
Views: 2095