Why is my swf taking up more space than it actually is?
I created a simple flash animation to work like a slideshow on the front page of my website. Because the container was 640 by 500 with a padding of 10 px all around, I made the swf 620 by 480 to fit perfectly. For some strange reason, whenever I preview my site or upload it to my host server, scroll bars appear, indicating that the animation is slightly too big. I can't understand what I'm doing wrong. Here's the HTML pertaining to the animation and the container:
<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>
And here's the CSS for the container:
.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;开发者_StackOverflow
}
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;}*/
The <div class="mainspace">
Is actually 620x480 (not 640x500, as you said), with a padding of 10px. This makes the actual area of the <div>
600x460, since padding is on the inside, so you are overflowing.
Change
.mainspace {
width:620px;
height:480px;
...
to
.mainspace {
width:640px;
height:500px;
...
The DIV with the class mainspace has a left margin of 160px; is that what you mean?
精彩评论