Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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 - Fatal编程技术网

Html 显示水平居中的iFrame

Html 显示水平居中的iFrame,html,Html,我在php中有一个iFrame,我想至少将它显示为水平居中,这是我的代码。如何编辑它使其在浏览器中显示水平中心 <!DOCTYPE html> <html class="no-js" lang="en"> <head> </head> <body> <div> <iframe src="https://<??>" width="850" target="_parent" height="850" scro

我在php中有一个iFrame,我想至少将它显示为水平居中,这是我的代码。如何编辑它使其在浏览器中显示水平中心

<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
</head>
<body>

<div>
<iframe src="https://<??>" width="850" target="_parent" height="850" scrolling="no" style="overflow:hidden; border:none;" style = "display:block;"></iframe>
</div>

</body>
</html>

  • 您有两个独立的样式标记。一定要把它们合并成一个
  • 尝试添加
    边距:0自动到您的样式标记

  • 您需要将iframe放在div中,然后使用css在div中居中,如下所示:

    <div class="myframe">
    <iframe src="http://google.com" width="850" target="_parent"  height="850" scrolling="no"         border:none;></iframe>
    </div>
    
    <style type="text/css">
    .myframe
    {
    margin: 0px auto;
    width: 850px;
    }
    </style>
    
    
    .我的框架
    {
    保证金:0px自动;
    宽度:850px;
    }
    
    删除额外的样式属性,合并为一个:
    style=“border:none;width:850px;margin:20px auto;”