Reputation: 107
If text is long then text moves to next line after image. How to wrap text around image?
CSS:
img {
float: left;
width: 200px;
height: 200px;
}
.description {
border: 1px solid #000;
display: inline;
}
Thanks in advance.
Upvotes: 0
Views: 56
Reputation: 446
This is done by floating elements. See the fiddle
CSS:
.wrapper img
{
float:left;
margin-right:10px;
}
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>
Upvotes: 0
Reputation: 85545
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*/
}
Upvotes: 2