空格将文本移动到新行

时间:2015-06-07 16:14:38

标签: css

没有空间会发生什么: http://i.imgur.com/KoClfup.png 空间会发生什么: http://i.imgur.com/BEnGeLM.png 我希望它像第二张图像一样转到第二行。

我尝试使用自动换行:break-word和禁用overflow:auto但没有成功。



    <div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%;">
    	<img src="" alt="BUFF" style="color:white;background:lime"> 
    		<p style="margin: 0 1% 0 1%; ">
    			fkdjhflgdfmlhfddmflhdfmlhfgmlmsdmqskdflmgdffdszrpooppomfllbcclkdjhflgdfmlhfddmflhdfmlhfgmlmsdmqskdflmgdffdszrpooppomfllbcclkdjhflgdfmlhfddmflhdfmlhfgmlmsdmqskdflmgdffdszrpooppomfllbcclkdjhflgdfmlhfddmflhdfmlhfgmlmsdmqskdflmgdffdszrpooppomfllbccl
    		</p>
    </div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

您可以再试一次,但也可以添加溢出:隐藏在段落上。请参阅下面的示例

&#13;
&#13;
div {
  border: 1px solid #ddd;
}
p {
  word-wrap: break-word;
  overflow: hidden;
}
&#13;
<div style="overflow: auto;width: 100%; min-height: 41px; max-height: 100%;">
  <img src="http://placehold.it/80x50" style="float: right;">
  <p style="margin: 0 1% 0 1%; ">
    htrhtrhtrhrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrthrtharsgrfesgrefresfgregrdsgfdsgrtesgre
  </p>
</div>
&#13;
&#13;
&#13;