使用div自动重新调整大小

时间:2013-06-14 03:53:26

标签: css html

这个iframe怎么样:

<iframe src="http://www.gamepuma.com/external.html?http://data.gamepuma.com/games/06/crash-bandicoot.swf"  width="600"  height="400"frameborder="0" marginwidth="0" scrolling="no"></iframe>

由div自动重新调整大小?我这样做的方式不起作用。

.showgame {
    width: 640px;
    height: 480px;
    margin:0;
    padding:0;
    position: absolute;
    left: 0px;
    top: 40px;
}
<div class="showgame">
<?php echo $row_GameData['strGame']; ?> 
</div>

1 个答案:

答案 0 :(得分:0)

更改您的css选择器
.showgame

.showgame iframe

您可以直接定位iframe以调整其大小。

如果您希望将所有样式保留在该包装器div上,您应该可以添加它:

.showgame iframe {
    width: 100%;
    height: 100%;

    border: 0;
    /*OR*/
    box-sizing: border-box;
    -moz-box-sizing: border-box;
}
相关问题