将照片位置与css对齐

时间:2009-01-18 05:28:26

标签: css image

我目前的项目是新闻门户网站。一些用户能够将新闻与一些与之相关的媒体(如图片)放在一起。目前,CSS将图片放在文本后面的右下角。我想将照片放在文本的右上角,就像在example中一样。有什么想法吗?

1 个答案:

答案 0 :(得分:3)

您正在寻找CSS float property

<div style="float:right">
  <img src="yourimage.jpg" />
  <p>Caption goes here...</p>
</div>
<div>
   The rest of your text goes here and
   will wrap around the image as in
   the example link you provided.
</div>