[英]Long text break in div
How can I fix the text so that it stays in line with the picture ? 如何固定文本,使其与图片保持一致? I have tried adding "word-wrap: break-word" but it doesn't work.
我尝试添加“自动换行:断词”,但是它不起作用。
/* 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/ https://jsfiddle.net/u9zg4vLs/
将float:left
仅添加到<img>
标签
.float-my-children > img { float:left; margin-right:5px; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.