English 中文(简体)
Unwanted vertical space after Flash object
原标题:

See the code below:

<div>Lorem ipsum dolor sit amet</div>  
    <object  
        type="application/x-shockwave-flash"  
        data="banner.swf"  
        width="965"  
        height="120"  
    ></object>  
<div>Consectetur adipiscing elit</div>

Viewing it in either Gecko, Webkit or Presto, an unintentional vertical space occurs after the object, before the second div (see http://jooadam.hu/object). Removing whitespace from between tags, or explicitly setting margin and padding does not help.

Any help would be appreciated.

最佳回答

In the meantime someone answered my question on another forum. Objects, like images are inline-block elements; setting display: block on object solves the problem.

问题回答
<div>Lorem ipsum dolor sit amet</div>
<object width="965" height="120">
    <embed src="banner.swf" type="application/x-shockwave-flash" width="965" height="120"></embed>

Lorem ipsum dolor sit amet

This problem really got me curious, besides the fact that I would use a different approach like using SWF object, the whitespace seemed to come out of nowhere.

I fiddled around a bit with firebug and found a way to fix it by just adjusting the styles:

#container { line-height: 0;}
#header, #footer { line-height: 1em;}

However I suspect that if you add a around the object tag it should fix itself.

<object width="965" height="120" align ="middle">

Align the object to the middle. Object placeholder will then be overlapped by the image or Flash content.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签