簡體   English   中英

div中的長文本中斷

[英]Long text break in div

如何固定文本,使其與圖片保持一致? 我嘗試添加“自動換行:斷詞”,但是它不起作用。

 /* tell the container's children to float left: */ .float-my-children > * { float:left; margin-right:5px; } /* this is called a clearfix. it makes sure that the container's children floats are cleared, without using extra markup */ .clearfix { *zoom:1 /* for IE */ } .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } /* end clearfix*/ /* below is just to make things easier to see, not required */ body > div { border:1px dashed red; margin-bottom:10px; } 
 <div class="clearfix float-my-children"> <img src="//upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Balzac.jpg/220px-Balzac.jpg" width=100> <div>some long text here here here here here here here here here here here here here here here here here here here here here here here here</div> </div> 

https://jsfiddle.net/u9zg4vLs/

float:left僅添加到<img>標簽

.float-my-children > img { float:left; margin-right:5px; }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM