让 php 回声在图像周围浮动


Getting php echo to float around image

我绝不是专家,但我或多或少设法过得去。

我在我的网站上创建了一个特定尺寸的"盒子"。

让我们称之为

<div class="newsbox" style="size, width etc.">

在该类中,我放置了这样的图像($this-getThemePath是特定于CMS的):

<div class="image" style="position:fixed; top:15%; left:20%; padding-top: 3px; padding-left:3px; float:left;">
<img src="<?php echo $this->getThemePath()?>/images/postit_today.png"></div>

之后,我有一个循环从我的数据库中写出内容,如下所示:

<div class="newsstyling" style="font-size: 16px;"><?php echo nl2br($news .= "'n");?></div>

最后,我关闭"新闻框"的标签

在我的新手中,任何通过循环写出的文本都应该漂浮在上面的图像周围。其实不然。它忽略图像并在其下方写入文本。

任何提示,

提示,链接或指南将不胜感激。

谢谢托马斯

那是因为您使用的是position:fixed,定位的元素在网页的正常流程之外,请尝试以下操作:

<img style="float:left" /><div>my text, foo, bar, etc.....</div>

更改

<img src="<?php echo $this->getThemePath()?>/images/postit_today.png">

<img src="<?php echo $this->getThemePath()?>/images/postit_today.png" style="float:right" hspace=10 vspace=10>