tags:

views:

51

answers:

5

Why gose to image's flow

This is code:

    <p><img class="left" width="95" height="64" src="#" />
    some text here some text here some text here some text here some text here some text here
    </p>

    <ul>
       <li>some text here some text here some text here some text here some text here some text here some text here
      </li>
    </ul>
+1  A: 

Because you're floating the image left. That's what happens. The bullet is behind the picture.

D_N
but image is inside <p> which is not floated left
metal-gear-solid
Correct. If it were floated left, it would contain the float on your image.
D_N
Floated elements fall through the bottoms of their containers. http://complexspiral.com/publications/containing-floats/
David Dorward
If you want the P to contain the float you've put on your IMG, you need to apply a clearfix or set the P to overflow:hidden.
D_N
A: 

Presumably because a CSS rule-set that applies to the element includes the rule float: left

David Dorward
A: 

Remove class="left" :)

Silver Light
but i can't remove left because i need image on left side
metal-gear-solid
Isn't it the default to align stuff to the left? Or do you also need the wrapping?
Martha
+1  A: 

Probably because

  • the image is float: left

  • either the <ul> or the <li> or both is display: inline

I assume you want to keep the left float of the image. To get the <ul> onto its own line, you could give it a display: block; clear: left; to sort it out.

Pekka
@Pekka - I can't apply css for <P> and <ul> because code is CMS generated .is it possible to add something in class left
metal-gear-solid
@jitendra no, I don't think so. You'd have to either influence the `p` (clear: both) or the `ul`. I can't think of a way to sort this with the image alone.
Pekka
A: 

If you have control over the .left class, add some padding or margin to the right side of the image.

.left {float:left;padding-right:2em;}

or

.left {float:left;margin-right:2em;}

The exact amount of padding/margin you need depends on how the list is styled - you want to add enough so that the list bullet doesn't overlap the image, but the paragraph and other stuff doesn't go too far to the right.

Which of padding-right or margin-right to use depends on what else is going on in the page, what browser(s) you are using, and somewhat also on personal preference. Try each and see which one works better in your situation.

Martha