我绝不是专家,但我或多或少地设法过关了。
我在我的网站上创建了一个特定大小的“框”。
就叫它吧
<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>
最后,我关闭“新闻箱”的 - 标签
在我看来,诚然是新手,通过循环写出的任何文本都应该 float 在上面的图像周围。它没有。它会忽略图像并在其下方写入文本。
我们将不胜感激任何提示、提示、链接或指南。
谢谢, 托马斯
最佳答案
那是因为你正在使用 position:fixed
,定位元素在网页的正常流程之外,试试这个:
<img style="float:left" /><div>my text, foo, bar, etc.....</div>
关于php - 让php echo漂浮在图像周围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19510907/