Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 无法使用固定位置创建iframe_Html_Css - Fatal编程技术网

Html 无法使用固定位置创建iframe

Html 无法使用固定位置创建iframe,html,css,Html,Css,我需要创建具有固定(绝对)位置的iframe。 我用 但它不起作用:( 我的iframe显示的样式“左”和“顶”为0 所以问题是如何在页面上创建具有固定位置的iframe,并正确设置左参数和上参数 注意!更改为100px和10px,以便定位生效 使用CSS或内联CSS时,您需要指定像素(px),否则它将无法生效。尝试在iframe周围放置一个div,并将样式设置应用于该div,而不是iframe: <div style="position: fixed; left: 100; top:

我需要创建具有固定(绝对)位置的iframe。 我用


但它不起作用:( 我的iframe显示的样式“左”和“顶”为0

所以问题是如何在页面上创建具有固定位置的iframe,并正确设置左参数和上参数


注意!

更改为
100px
10px
,以便定位生效


使用CSS或内联CSS时,您需要指定像素(px),否则它将无法生效。

尝试在iframe周围放置一个div,并将样式设置应用于该div,而不是iframe:

<div style="position: fixed; left: 100; top: 10">    
<iframe src="http://www.whatismyreferer.com" width="300" height="300" ></iframe>
</div>


由于新的div包含iframe,您应该能够以这种方式控制它

这里可能找到的重复项:单位。
10
没有任何意义。
10px
有任何意义。谢谢!在除IE7之外的所有现代浏览器中都非常有效。我将搜索解决方法。没问题,如果您不介意将我的答案投票为正确,我真的很感激吃了它!
<div style="position: fixed; left: 100; top: 10">    
<iframe src="http://www.whatismyreferer.com" width="300" height="300" ></iframe>
</div>