28

I have a small css script that force <a> tag word-wrap in a div. It worked fine on FF, Chrome but didn't work on IE9. How can I fix it?

.tab_title a{
    word-wrap: break-word;
} 
hungneox
  • 9,333
  • 12
  • 49
  • 66
  • The solution in this post worked for me: [http://stackoverflow.com/a/36042412/2383765](http://stackoverflow.com/a/36042412/2383765) – Magnus Mar 16 '16 at 18:36

9 Answers9

29

For a similar issue, I used display: inline-block on the <a> tag, which seems to help. And word-break: break-all as I was concerned with long URLs not wrapping.

So, this in your case essentially...

.tab_title a {
    display: inline-block;
    word-break: break-all;
} 
Si Clancy
  • 291
  • 3
  • 2
17

For me it worked in both Chrome and IE with:

.word-hyphen-break {
  word-break: break-word;
  word-wrap: break-word;
  width: 100%;
}

like this no need to configure specific width.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
anniete
  • 191
  • 1
  • 4
13

This might do the trick: http://www.last-child.com/word-wrapping-for-internet-explorer/

Another post also suggests applying word-break:break-all and word-wrap:break-word to it.

RAS
  • 8,100
  • 16
  • 64
  • 86
Duke Hall
  • 582
  • 4
  • 12
8

Try this:

.tab_title a{
    -ms-word-break: break-all;
    word-break: break-all;
    word-break: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
} 
Danny Connell
  • 782
  • 1
  • 8
  • 18
4

I remove the anchor tag after .tab_title class and it works

Thanigainathan
  • 1,505
  • 14
  • 25
hungneox
  • 9,333
  • 12
  • 49
  • 66
3

word-wrap: word-break; works only in ff and chrome and not in IE8 and IE9.
word-break: break-all; does not work either.

Anri
  • 6,175
  • 3
  • 37
  • 61
Prachi
  • 31
  • 1
3

I have had good success in Chrome, Firefox and IE with using:

word-break: break-word;
word-wrap: break-word;

In my problem case I was using:

display: table-cell;

and I ended up having to include

max-width: 440px;

to get wrapping in all browsers. In most cases the max-width was not necessary. Using

word-break: break-all;

does not work well in IE because although long words without spaces will be wrapped, short words also stop wrapping at spaces.

Darren Reimer
  • 741
  • 8
  • 9
  • fyi, I also had the same issue with IE11. I got it to wrap big words in my table, but it seems to wrap tiny words as well, when it could have easily put it into a separate line. I'm glad I'm not the only one. Did using max-width fix it for you? I just tried it on my TD, but no luck. – NL3294 Feb 06 '18 at 01:13
  • Yes, in most cases: word-break: break-word; word-wrap: break-word; worked, but in the one case that it didn't, also specifying max-width did the trick. – Darren Reimer Feb 08 '18 at 15:40
0

I recently was fighting this in Angular between IE/Edge & Chrome. Here is what I found worked for me

  overflow-wrap: break-word;
  word-wrap: break-word;

This gave me the best of both. It would break the word that was too long, but unlike word-break it would not break mid-word.

Brian S
  • 3,096
  • 37
  • 55
-1

i just figured out that word-wrap:break-word works only partially in IE8 and IE9. If I have a string of words with spaces, then that string gets wrapped. But if my string consists of one long word, it forces the parent/container element to expand according to its width

Prachi
  • 1