Search code examples
csshtmlxhtmlword-wrap

Word-wrap around a specific character


I have a string which looks like an absolute path : Dir1\Important\Info 123\test. I have that string in a h:outputText tag.

I want to word-wrap that string just before ot just after the \ character. The default wrapping in css is for whitespaces. I can't use that because I have whitespaces in the some names. I want the string to break only at the \ character.

How can I achive such word-wrapping? Any help is welcomed :)

PS: I can use <wbr> to give it a hint, but the problem with the whitespaces stays.

PSS: The tag looks like this:

<h:outputText id="fullPath"           value="#{configItemDtoSearch.fullPath}" 
                                      style="color:#03A9F4; font-style: italic; white-space: nowrap; width: 200;"/>

Solution

  • You can use &nbsp; instead of the white space characters. &nbsp; is a non breaking space character. So the string should look like:

    Dir1\<wbr />Important\<wbr />Info&nbsp;123\<wbr />test