sssss700121
sssss700121

Reputation: 51

HTML - img with CSS and text

I try to put a picture in the right side of the page. the problem is that there is a text near it, and in some browsers the picture hide the text. I use the next CSS for the <img> attribute:

.imgP
{
position:relative;
top:10px;
right: 10px;
float:right;
}

the text is the next element:

<p> bla bla bla... </p>

How can I change it, in order that the text would move automatically near the picture?

Upvotes: 0

Views: 84

Answers (1)

Axel
Axel

Reputation: 10772

What I think you're trying to achieve it text-wrapping on an image.

The principle for doing this is simple.

Create some HTML markup like this:

<img src="myimage.jpg" alt="" class="imgP" />
<p>My Paragraph text which will wrap around the image...</p>

And to make the text wrap the image, you simply float the image to the right:

.imgP
{
   float: right;
}

A float will cause the horizontal spacing that the image sits on to collapse, and cause the text to fill that area.

Upvotes: 1

Related Questions