如何在图像上包装文本?

时间:2016-04-26 14:10:12

标签: css

Snap1: it is okey[![Snap2: A very long word comes next (in the next line)to the image

如何使这个长单词(单词的一部分)出现在同一行的图像中?我试过了:

<div style="width:200;background:#00FFFF;word-wrap:break-word;">
 <img src="1.png">ThisIsAveryVeryVeryLongWordNextToTheImage
</div>

2 个答案:

答案 0 :(得分:0)

使用white-space: nowrap

<div style="width:200px;background:#00FFFF;word-wrap:break-word;white-space: nowrap;">
  <img src="1.png">ThisIsAveryVeryVeryLongWordNextToTheImage
</div>

同样使用width: 200px,因为width:200在CSS中无效。

<强>更新

<div style="width: 200px; background: #00FFFF; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;">
  <img src="//placehold.it/100x100" />ThisIsAveryVeryVeryLongWordNextToTheImage
</div>

答案 1 :(得分:0)

&#13;
&#13;
<div style="width:200;background:#00FFFF;word-wrap:break-word;word-break: break-all">
  <img src="1.png">  ThisIsAveryVeryVeryLongWordNextToTheImage
</div>
&#13;
&#13;
&#13;