Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS word-wrap: break-word don't work on IE9

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; }  
like image 638
hungneox Avatar asked Dec 06 '11 02:12

hungneox


People also ask

How do I fix word break in CSS?

For English and many other languages, the correct breaking means hyphenation, with a hyphen added at the end of a line when a break occurs. In CSS, you can use hyphens: auto , though you mostly still need to duplicate it using vendor prefixes.

How do I break a specific word point in CSS?

You can use the <wbr> HTML element. It specifies a "word break opportunity", meaning it will break at that point only if needed (e.g., on small screens).

Can I use overflow wrap break word?

You can use the word-wrap , overflow-wrap , or word-break CSS properties to wrap or break words that would otherwise overflow their container.


2 Answers

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; }  
like image 100
Si Clancy Avatar answered Sep 28 '22 04:09

Si Clancy


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.

like image 22
anniete Avatar answered Sep 28 '22 06:09

anniete