How to word-wrap a URL?

Word wrap works well on long strings without any special characters. I'd like to use it on a URL. Rather than filling all the columns in a row, the text goes to the next row on encountering special characters like =, & etc. Is there some other method to solve this? HTML:

<div style="word-wrap: break-word; width:100px;" id="foo"></div>


var div = document.getElementById("foo");
div.innerHTML = "";

JS Fiddle here.

PS: Overflow isn't very nice!



Try using word-break: break-all;

var div = document.getElementById("foo");
div.innerHTML = "";
  word-break: break-all;
<div style="width:100px;" id="foo">


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.