为什么我的瑞士法郎比实际占用的空间更大?

时间:2011-08-21 16:03:14

标签: html css resize flash overflow

我创建了一个简单的flash动画,就像我网站首页上的幻灯片一样。因为容器是640乘500,周围有10 px的填充物,所以我将swf 620制作成480以完美贴合。出于某些奇怪的原因,每当我预览我的网站或将其上传到我的主机服务器时,都会出现滚动条,表明动画有点太大了。我无法理解我做错了什么。这是与动画和容器有关的HTML:

<div class="mainspace">

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="620" height="480" id="windexslideshow">
<param name="movie" value="images/indexslideshow.swf"/>
<param name="wmode" value="transparent"/>
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="images/indexslideshow.swf" width="620" height="480">
    <param name="movie" value="images/indexslideshow.swf"/>
    <param name="wmode" value="transparent"/>
<!--<![endif]-->
    <a href="http://www.adobe.com/go/getflash"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/></a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object> 
</div>

这是容器的CSS:

.mainspace {
width:620px;
height:480px;
overflow:auto;
position:absolute;
text-align:left;
margin:0px 0px 0px 160px;
padding:10px; /*adds to the content area above (width and height), so it's actually 640 by 500*/
z-index:1;
}

.mainspace img {
border:none;
}

.mainspace .slide {
margin-left:auto;
margin-right:auto;
width:620px;
}

.imglinks1 {
margin-left:auto;
margin-right:auto;
width:50px;
border:none;
z-index:2;
}

.imglinks2 {
margin:0 0px 0 0px;
float:left;
border:none;
z-index:3;
}

body .mainspace {
}

.mainspace p {margin:0px 0 14px 0;}

.mainspace h1 {margin-left:10px; font-size:18px; color:#56AD3D; clear:both;}
.mainspace h2 {margin-left:10px; font-size:15px; color:#56AD3D; clear:both;}
.mainspace h3 {margin-left:30px; font-size:15px; color:#56AD3D;}
.mainspace h4 {margin-left:40px; font-size:15px; color:#56AD3D;}
.mainspace h5 {font-size:16px;}
.mainspace h6 {font-size:16px;}

.mainspace a:link {color:#E0D3C6; text-decoration:none;}
.mainspace a:visited {color:#56AD3D; text-decoration:none;}
.mainspace a:hover {color:#56AD3D; text-decoration:none;}*/

2 个答案:

答案 0 :(得分:1)

<div class="mainspace">实际上是620x480(不是640x500,如你所说),填充为10px。这使得<div> 600x460的实际区域,因为填充在内部,所以你溢出。

更改

.mainspace {
  width:620px;
  height:480px;
  ...

.mainspace {
  width:640px;
  height:500px;
  ...

答案 1 :(得分:0)

具有类主空间的DIV的左边距为160px;这就是你的意思吗?