2

In the master page of mine the above line exists

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

But why is it getting me problems?

In a content page i am embedding an SWF object

var flashvars = {xmlPath: "xml/" + GetQueryString("x") + ".xml" };
  var params = { allowFullScreen: "true", wmode: "transparent" };
  var attributes = {};
  swfobject.embedSWF("main.swf", "gallery", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);

If i comment out the DOCTYPE "line" the SWF object fills the screen (As it should). If i DO NOT comment out the DOCTYPE "line" the SWF object fills only in horizontal direction.

So what is going on here? Could i have both DOCTYPE and the SWF object tiled in both vertical and horizontal direction?

UPDATE: And here is the CSS that is applied without success

<style type="text/css">
*{
margin:0;
padding:0;
}
html, body, #gallery { background: #EFEFEF; height:100%; }
body { margin:0; padding:0; overflow:hidden; }
</style>

ANOTHER UPDATE: In Chrome it works great, in Internet explorer the SWF fills 20% of the display and is placed at the top of the page and finally in Firefox, nothing is displayed.

4

1 回答 1

3

在标准模式下,如果您希望静态定位的元素与视口高度相同,则它和所有祖先(可能包括bodyand html)都必须具有 CSS height: 100%。高度是相对于父级的100%大小,如果父级没有明确的高度,百分比是没有意义的。

如果您希望绝对定位的元素与视口具有相同的高度,则它是相同的,但定位包含块而不是每个元素。这种情况通常更容易,因为视口和元素之间可能没有任何包含块。

在 Quirks 模式下(这是您删除 doctype 时得到的),height: 100%通常会产生不同的效果,其中包括许多通常不太有用的错误。

于 2010-11-10T21:17:20.257 回答