开发者

Wrap text around a right-aligned icon?

开发者 https://www.devze.com 2023-01-01 16:20 出处:网络
Is it possible to make a small box (which will be a row element in a list for me) with an icon in the upper right corner, and text wrapped around it? Something like:

Is it possible to make a small box (which will be a row element in a list for me) with an icon in the upper right corner, and text wrapped around it? Something like:

-------------------------------------------------
| Some text here which may wrap around  [icon]  |
| if it were to get too long, but then fit well |
| around the icon in the upper right corner?    |
--------------------开发者_如何学JAVA-----------------------------

I was going to use this as a row in a list, and the user could click the icon in the upper-right to delete the row. I could use either a <div> or a <table>, I'm not sure which will be better?:

<div> 
  <p>The text</p>
  <img src="close.png" align="upper-right">
</div>

Thanks


Sounds like a job for a float.

<div> 
    <img src="close.png" style="float: right" />
    <p>The text</p>
</div>


Perfect, thanks!

You could also put the float in the div:

<div style="float: right">
   Any type of content (tables, lists, images, other divs, etc)
</div>

You might want to specify the width though.

0

精彩评论

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