【问题标题】:Width and height properties for a website loaded in a DIV在 DIV 中加载的网站的宽度和高度属性
【发布时间】:2023-03-20 14:03:01
【问题描述】:

我之前尝试在 iframe 中执行此操作。现在我在 DIV 中进行了这项工作,但一直无法获得所需的属性。

当尝试更改“站点加载器”的属性时,由于某种原因它会忽略嵌入式网站,因此我无法将嵌入式网站更改为 100% 的宽度和高度。但是,我可以为 'siteloader' div 的背景执行此操作。

我已经为你附上了我的所有代码和屏幕截图

CSS

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">    </script>

<style type="text/css">

body {
    background: #000;
    margin: 0;

}

#siteloader {
    background: white;
    width:100%;
    height:100%;
    border:none;
    position:fixed;
    top:0px;
    marginwidth:0;
    hspace:0;
    vspace:0;
    z-index: ;

}


</style>

HTML

<body>
    <div id="siteloader">
        <script>
        var page, randomcontent=new Array()

        randomcontent[0]="http://sandberg.nl/manifesto"
        randomcontent[1]="http://wikipedia.org"
        randomcontent[2]="http://iamsterdam.com"
        randomcontent[3]="http://therevolvinginternet.com/"

        page = randomcontent[Math.floor(Math.random()*randomcontent.length)]

        $("#siteloader").html('<object data=' + page + ' >');
        </script>

    </div>    
</body>

截屏

【问题讨论】:

  • 你试过设置body,html { width: 100%; height: 100%; }吗?
  • 您有机会查看我的回答吗?

标签: jquery html css height embedding


【解决方案1】:

正如我原来的评论所说,试试这个:

html,body{ width: 100%; height: 100%; }

【讨论】:

    【解决方案2】:

    尝试将其添加到您的 CSS:

    #siteloader object {
    width:100%;
    }
    

    在这个小提琴上工作:

    http://jsfiddle.net/z54fZ/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多