I've set up a fixed width div with several links inside, each with text containing non-breaking spaces between the words.
My goal is to ensure that when a link reaches the edge of the div, the entire link moves down to the next line.
While testing in JSFiddle, I initially had a single unformatted piece of html and noticed the final link did not move to a new line as desired.
Upon reformatting the code with tags on separate lines, the final tag now appropriately moves to a new line when it hits the width limit of the div.
The HTML is being dynamically generated from a script, producing a concatenated string for rendering. Here is the HTML used along with a working fiddle demonstrating both approaches:
http://jsfiddle.net/8gdez8ur/2/
<div style="width: 350px; overflow: hidden;"><a href="#" action="zoom" style="font-size:11px;padding-right:2px;">Zoom</a><a action="streetview" href="#" style="font-size:11px;padding-right:2px;"> Street'nbsp;View</a><a action="addplacemarker" href="#" style="font-size:11px;padding-right:2px;">Add'nbsp;Placemarker</a><a action="route" href="#" style="font-size:11px;padding-right:2px;">ETA'nbsp;To</a><a action="reportproblem" href="#" style="font-size:11px;padding-right:2px;">Incorrect'nbsp;Location'nbsp;Details</a><a action="sendmessage" href="#" style="font-size:11px;">Send'nbsp;Message</a></div>
<hr>
<div style="width: 350px; overflow: hidden;">
<a href="#" action="zoom" style="font-size:11px; padding-right:2px;">Zoom</a>
<a action="streetview" href="#" style="font-size:11px; padding-right:2px;">Street'nbsp;View</a>
<a action="addplacemarker" href="#" style="font-size:11px; padding-right:2px;">Add'nbsp;Placemarker</a>
<a action="route" href="#" style="font-size:11px; padding-right:2px;">ETA'nbsp;To</a>
<a action="reportproblem" href="#" style="font-size:11px; padding-right:2px;">Incorrect'nbsp;Location'nbsp;Details</a>
<a action="sendmessage" href="#" style="font-size:11px; padding-right:2px;">Send'nbsp;Message</a>
</div>
What could be causing this discrepancy in behavior? Any insights are appreciated!