2017-08-04 17:29
浏览 72

iframe src全宽和高度

how can i make iframe src to full width and height ?

for example i have iframe like this

<iframe scrolling="no" frameborder="0" allowtransparency="true" style="border:none;width:100%;height:100&;" allowfullscreen="" src="http://www.example.com/page.php?width=100%&height=100%"></iframe>

this is just gonna have full size width and height of iframe only.

as you see this part page.php?width=100%&height=100%

if i keep it like that, it won't work. even if i make it like this page.php?width=auto&height=auto

what i need here to make this page.php?width=100%&height=100% to go full iframe width and height because the content of page.php will be resized if i change the size like this page.php?width=200&height=200

anyone help me with this please. appreciate it

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsa45664 2017-08-04 17:38

    Well passing the url query is a start but you need to use that information to give the page styling:


    This is just a rough example of what you might try, you may want to change the styles depending on whats necessary for you.

    <?php if (!empty($_GET['fullscreen'])) {?>
    html, body {
    <?php } ?>

    You could do something similar passing in width and height independently and then using those values in the css:


    <?php if (!empty($_GET['width']) && !empty($_GET['height'])) {?>
    html, body {
      height:<?php echo $_GET['height']; ?>px;
      width:<?php echo $_GET['width']; ?>px;
    <?php } ?>
    打赏 评论

相关推荐 更多相似问题