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; }
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.
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).
You can use the word-wrap , overflow-wrap , or word-break CSS properties to wrap or break words that would otherwise overflow their container.
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; }
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With