Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:09:21+00:00 2026-06-18T06:09:21+00:00

I have seen and gone through too many pages explaining the same problem and

  • 0

I have seen and gone through too many pages explaining the same problem and having various successes. What I am trying to do is come up with a method that I can break up large words so that they don’t break table/divs/etc by stretching the contents beyond the specified width. I need this to be done for a percentage width element. I feel like I have tried everything, but there must be a solution, even if it is a hack. The best solution that I have found so far is to use hyphenator js. It works beautifully for most long words EXCEPT it only seems to work on real words that can be found in a dictionary file. For example, this is broken up nicely in all my examples:

ThisisalongstringoftextandifIwasusinghyphenatorjsonthisthenitwouldbreakupnicelywithhyphensandeverythingwouldbegood

Things like these do not get broken and instead it breaks my site:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Most sites that I want to use this on allow user created text to appear on the site, and things like the long string of equal signs and hyphen characters are common. I also notice that stackoverflow combats this problem by using the word-wrap: break-word; css (at least in firefox). I have experimented with this and found that it works great, but only works when using pre-defined pixel widths and I need a solution that works with percentage widths. I have also used word-wrap: break-all which works but it looks ugly because it cuts small words off in the middle when it should wrap the word instead.

If possible I would like to continue using hyphenator as it works great most of the time. Maybe I have been looking at this too long, but is there some sort of options in hyphenator that I can set to make it break up non-words like those above that are too big? Maybe someone has had some success with adjusting hyphenators regex to make this happen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:09:22+00:00Added an answer on June 18, 2026 at 6:09 am

    Setting word-wrap: break works (in the technical sense) for percentage widths, too, it seems to fail for tables with percentage widths for cells/columns, even when table-layout has been set to fixed. To work around this, it seems necessary to add line breaking hints into the content.

    The old line breaking hint is <wbr>, but some browsers now have issues with it. The new line breaking hint is the ZERO WIDTH SPACE character, which can be written as &#x200b; or as such (when using UTF-8); it works well in modern browsers but causes nasty effects on old versions of IE. I tend to vote for the latter these days, but on my page on line breaking issues, I explain that there is a “bulletproof” but awkward method: use <wbr><a class=wbr></a> with the CSS rule .wbr:after { content: "\00200B"; }. When you generate a page programmatically, such clumsy markup might be feasible.

    You should insert such hints only when needed. They should not be used for words in natural languages. As a simple approach, when you process user input for rendering on your page, you could split it to “words” in the technical sense (maximal non-whitespace strings) and then, for every “word” longer than N characters, insert a line breaking hint after any K characters. The parameters N and K would need to be selected according to your layout. The drawbacks: This would cause “emergency breaks” as if a string contained a space but doesn’t, and this could arbitrarily break long natural-language words, too.

    Perhaps you could do things client-side, first running Hyphenator.js, then processing the text content so that you split the text content into fragments at any whitespace and at any soft hyphen (\00AD; you need to make sure that you do this only after Hyphenator.js has completed its work). Then you can run the algorithm above on the fragments, i.e. add line breaking hints to long fragments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen many posting this issue in SO. I have gone through those
I'm trying to get the zoom control on my webview. I have seen many
I have seen many examples but none is according to my problem...in my case
I have gone through the examples of Add-on SDK 1.5 yet haven't seen anything
I am beginner to free switch.I have gone through the configuration file vars.xml in
Before someone starts ranting: I have already gone through several similar questions on numerous
I have seen many application doing voice recognition on the iphone. I have already
I am familiar with the jQuery animate function and I have also gone through
I've seen this question asked numerous times and have gone over my code over
I have gone through the Android guide for other IDEs , and I've got

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.