我正在尝试将日历放在我页面的右上角:
<?php
echo 'other html 1';
echo 'other html 2';
....
// Calendar
echo '<iframe
src="https://calendar_link"
style = "border: 0;
position: absolute;
width: 500; // This does not have any effect, why?
height: 500; // This does not have any effect, why?
top: 160px; // This does not have any effect, why?
frameborder: 0;
scrolling: no;">
</iframe>';
?>
显示了日历,我可以改变它的大小,但我不知道如何将它移动到任意位置。无论我在做什么,它总是出现在其他 html 代码的下方。
注意:
我无法将 php 文件更改为 html 文件,因为此页面是更大系统的一部分
我不想依赖其他 echo 语句。如果不需要弄清楚该文件的其余部分发生了什么,就可以解决这个问题。
我很乐意将特定于
iframe
的样式内容移到单独的 css 文件中。
如何将 iframe
放在我想放的地方?
最佳答案
由于您正在定位您的 iframe,您应该使用 position 属性,并且如果您希望 iframe 出现在页面的右上角,那么您还应该使用 top 和 < strong>正确的属性来实现这个结果
<?php
echo '<iframe
src="http://cuassistant.tk/"
style = "
border: 0;
position: absolute;
display: block;
width: 500px;
height: 500px;
top: 0px;
right: 0px;
frameborder: 0;
scrolling: no;">
</iframe>';
检查以下链接 CSS position property
注意:由于 iframe 是 html 中的老东西,因此有很多属性已弃用。你最好看看下一页Iframe Tag
关于php - 如何在 php echo 语句中定位 iframe(日历)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39817481/