0

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?

3
  • 2
    Whats the css for the text, and can we see your html? Commented Mar 29, 2013 at 21:26
  • You can't use position and float together (get rid of the position). But you did not provide enough information, so we can't help you more. Commented Mar 29, 2013 at 21:34
  • A demo would be helpful. See: jsfiddle.net or codepen.io, placehold.it Commented Mar 29, 2013 at 21:36

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.