qwerty
qwerty

Reputation: 107

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:

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

http://jsfiddle.net/qw4fxdwb/

Thanks in advance.

Upvotes: 0

Views: 56

Answers (3)

SBD
SBD

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

Bhojendra Rauniyar
Bhojendra Rauniyar

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

Uttara
Uttara

Reputation: 2534

Use this, if this is what you want

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

Fiddle

Upvotes: 0

Related Questions