开发者

CSS - Image on right side of page with text not wrapping around it

开发者 https://www.devze.com 2023-01-16 20:33 出处:网络
This is probably a simple question, but I can\'t figure it out. I would like to use CSS to put an image on the right side of a page and not wrap text around it. I would like it like this:

This is probably a simple question, but I can't figure it out. I would like to use CSS to put an image on the right side of a page and not wrap text around it. I would like it like this:

             开发者_JAVA百科   ------------
                |    img   |
                |          |
                ------------
text text text text text text
text ....

If I do a float:right on the image, I get this:

text text text  ------------
text text text  |   img    |
text text text  |          |
text text text  ------------
text text text text text text
text ...

I could easily use tables to do this, but I would like pure CSS.


Something similar to this should work:

<div>
  <div style="width: 100%">
    <img style="float:right;">
  </div>
  <div>
    text
  </div>
</div>


<div>
        <img src="img.jpg" style="float:right;" />
        <div style="clear:right;">
            <!-- text here -->
        </div>

</div>

perhaps?

0

精彩评论

暂无评论...
验证码 换一张
取 消