html - 使用 float 并排嵌入 2 个 SWF 时,SWF 变得非常小

标签 html css css-float flash

当我使用 float 并排放置 2 个 SWF 时,我的第一个 SWF 奇怪地变得非常小。

由于某些原因,当将其宽度设置为 100% 时,它的宽度变为 300px 左右,而不是占用其他 SWF 未占用的宽度,即 900px 左右。

我需要将它设置为 100%,以便它的宽度自动调整为浏览器窗口的宽度,而不是仍然是 900 像素。我做错了什么吗?这是我的嵌入代码...

<html>
<head>
<style type="text/css">
#container {
   overflow:hidden;
   position: absolute;
    right: 100px;
}
#em-box {
float: left;
    margin: 10px;
}
#em-box2 {
   float: left;
    margin: 10px;
}
</style></head>
<body bgcolor="#FFFFCC">
<div id="container">
<div id="em-box"><embed width="100%" height="100%" name="plugin" src="game.swf" type="application/x-shockwave-flash"></div>
<div id="em-box2"><embed width="200" height="600" name="plugin" src="chat.swf" type="application/x-shockwave-flash"></div>
</div>


</body></html>

最佳答案

您必须仅在固定元素上设置 float 并调整另一个元素的边距以包含它的宽度加间距。另外,如果要获取整个页面,请设置容器宽度。

http://jsfiddle.net/8kmnyr54/

#container { /* defined width (optional) */
    overflow:hidden;
    position: absolute;
    right: 100px;
    width: 80%;
}

#em-box { /* defined fixed width */
    float: left;
    margin: 10px;
    width: 400px
}

#em-box2 { /* removed float and changed margin */
    margin: 10px;
    margin-left: 420px; /* em-box width + margins + padding + desired extra space */
}

关于html - 使用 float 并排嵌入 2 个 SWF 时,SWF 变得非常小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25649246/

相关文章:

javascript - 使用 JavaScript 作为 HTML 属性值的语法

html - 事件的非链接导航栏元素

html - 在 Chrome 中调整浏览器大小后表格标题折叠

css - HTML CSS div 向左浮动在下面,在 div 向右浮动下方?

css - float div 在 IE9 中未正确对齐

html - 垂直居中对齐 float 内容

html - 为什么 Safari 会截掉这段文字的顶部?

javascript - 如何在页面上居中显示 highcharts 饼图和图例?

JavaScript 未在 Ruby on Rails 中运行

javascript - 在不使用 WebGL 的情况下创建具有倾斜 View 的 map ?