我有一個固定寬度的div,包含一堆鏈接,每個鏈接都有文字,文字之間沒有空格。固定寬度div內的包裝鏈接
我試圖實現的是當鏈接命中div的邊緣時,整個鏈接沿着一條線移動。
我剛剛在JSFiddle中玩過,最初我有一個長的未格式化(沒有標籤在新行等)的一塊html,並觀察最後一個鏈接,而不是移動到一個新行。
然後我決定重新格式化,所以把新的標籤放在行上,這樣做後,最終的標籤現在移動到一個新的行,當它受到div的寬度限制。
我實際上是從一個腳本動態生成html,目前它只是爲我生成一個單一的連接字符串然後渲染。下面是我使用的HTML和工作搗鼓出這兩種方法的結果:
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 View</a><a action="addplacemarker" href="#" style="font-size:11px;padding-right:2px;">Add Placemarker</a><a action="route" href="#" style="font-size:11px;padding-right:2px;">ETA To</a><a action="reportproblem" href="#" style="font-size:11px;padding-right:2px;">Incorrect Location Details</a><a action="sendmessage" href="#" style="font-size:11px;">Send 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 View</a>
<a action="addplacemarker" href="#" style="font-size:11px; padding-right:2px;">Add Placemarker</a>
<a action="route" href="#" style="font-size:11px; padding-right:2px;">ETA To</a>
<a action="reportproblem" href="#" style="font-size:11px; padding-right:2px;">Incorrect Location Details</a>
<a action="sendmessage" href="#" style="font-size:11px; padding-right:2px;">Send Message</a>
</div>
爲什麼會出現這裏活動的差異? 感謝
存在「填充右:2px的」失蹤 –
感謝您指出了這一點,但它並不能幫助我在這種情況下 – mindparse
退出空間之前, 「Street&nbsp」in first div –