简体   繁体   English

如何在长文本周围换行?

[英]How to wrap image around the long text?

If text is long then text moves to next line after image. 如果文本较长,则文本将移动到图像后的下一行。 How to wrap text around image? 如何在图像周围换行?

CSS: CSS:

img {
    float: left;
    width: 200px;
    height: 200px;
}
.description {
    border: 1px solid #000;
    display: inline;
}

http://jsfiddle.net/qw4fxdwb/ http://jsfiddle.net/qw4fxdwb/

Thanks in advance. 提前致谢。

You can do like this demo : 您可以像这样演示

.wrapper-text{
    word-wrap: break-word; /*fixes the text to go below*/
    overflow: auto; /*fixes the whole text preventing to go below the image*/
}

Use this, if this is what you want 如果您要使用此功能

.wrapper-text {word-wrap:break-word;}

Fiddle 小提琴

This is done by floating elements. 这是通过浮动元素完成的。 See the fiddle 看到小提琴

CSS: CSS:

.wrapper img 
{
   float:left;
    margin-right:10px;
}

HTML: HTML:

<div class="wrapper"> 
    <img src="http://placehold.it/200x200" alt="placeholder">
    <div class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
 </div>

</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM