固定位置div总是出现在顶部吗?

发布于 2025-02-10 12:26:40 字数 1019 浏览 2 评论 0原文

我的CSS中有一个固定的位置标签,如下所示:

#facebook {
height: 249px;
width: 50px;
position: fixed;
left: 0px;
top: 200px;
}

我的网站上有一个flash(.swf)标头图像,当浏览器的分辨率足够低时,Facebook Div部分被Flash Header隐藏了。

这是我的HTML:

 <body id="index">
 <div id="facebook"><img src="images/facebook.png" width="50" height="249" border="0"      usemap="#Map" />
 <map name="Map" id="Map">
 <area shape="rect" coords="2,154,40,191" href="http://www.youtube.com/" />
 <area shape="rect" coords="3,202,39,240" href="http://www.facebook.com/group.php?gid=72781675198" />
 </map>
 </div>
 <div id="wrapper">
 …
   <div id="title_box"><object type="application/x-shockwave-flash" 
    data="images/flash.swf" 
    width="960" height="450">
 <param name="movie" value="images/flash.swf" />
 <img src="images/header.jpg" />
 </object></div>

我如何获得它,因此我的Facebook固定位置Div总是显示在此.SWF内容上?

预先感

谢乔恩

I Have a fixed position tag that is styled as follows within my CSS:

#facebook {
height: 249px;
width: 50px;
position: fixed;
left: 0px;
top: 200px;
}

There is a flash (.swf) header image on my website, and when the resolution of the browser is low enough, the facebook div is partially hidden by the flash header.

Here is my HTML:

 <body id="index">
 <div id="facebook"><img src="images/facebook.png" width="50" height="249" border="0"      usemap="#Map" />
 <map name="Map" id="Map">
 <area shape="rect" coords="2,154,40,191" href="http://www.youtube.com/" />
 <area shape="rect" coords="3,202,39,240" href="http://www.facebook.com/group.php?gid=72781675198" />
 </map>
 </div>
 <div id="wrapper">
 …
   <div id="title_box"><object type="application/x-shockwave-flash" 
    data="images/flash.swf" 
    width="960" height="450">
 <param name="movie" value="images/flash.swf" />
 <img src="images/header.jpg" />
 </object></div>

How do I get it so my facebook fixed position div is always displayed on top of this .swf content?

Thanks in advance

Jon

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

盗琴音 2025-02-17 12:26:40

z index

使用CSS样式z-index设置元素的垂直顺序。并给它一个足够高的值,以便它始终显示在顶部:

#facebook {
    height: 249px;
    width: 50px;
    position: fixed;
    left: 0px;
    top: 200px;
    z-index: 100;
}

通常呈现元素(以简化垂直顺序,根据其自然HTML流动)。因此,后来定义的元素对先前的元素进行渲染。

z-index

Use CSS style z-index that sets vertical order of your elements. And give it a high enough value so it will always display on top:

#facebook {
    height: 249px;
    width: 50px;
    position: fixed;
    left: 0px;
    top: 200px;
    z-index: 100;
}

Elements are usually rendered (to simplify it and in terms of vertical ordering) according to their natural HTML flow. So later defined elements are rendered over previous ones.

碍人泪离人颜 2025-02-17 12:26:40

如果内容被Flash阻塞,即使使用正确的z索引,则将wmode =“透明”添加到Flash Emped脚本。

If the content is obstructed by flash, even with a correct z-index, add wmode="transparent" to the flash embed script.

待"谢繁草 2025-02-17 12:26:40

您可以使用CSS样式的Z-Index在顶部显示菜单。

#menu
{
z-index: 100;
}

You can use CSS style z-Index to show your menu on top.

#menu
{
z-index: 100;
}
迷爱 2025-02-17 12:26:40

尝试位置:绝对;

try with position: absolute;

三人与歌 2025-02-17 12:26:40

只是为了澄清:仅在固定元素上设置z索引就无法解决问题。设置绝对位置不会使您产生效果。也许将父母设置为固定位置,然后将孩子设置为绝对位置和适当的z索引?

一个例子:

.fixed { position: fixed; z-index: 4000000; width: 200px; right: 0; top: 0; cursor: pointer; }
.fixed .show-menu { display:block; background-color: #ffffff; width:100%; padding: 10px; font-size: 18px; right: 0; position: absolute; z-index: 60000000; }

Just to clarify: Just setting the z-index on a fixed element won't do the trick. Setting the absolute position won't give you the effect your after. Perhaps setting a parent to fixed position and the child to absolute position and the appropriate z-index?

An example:

.fixed { position: fixed; z-index: 4000000; width: 200px; right: 0; top: 0; cursor: pointer; }
.fixed .show-menu { display:block; background-color: #ffffff; width:100%; padding: 10px; font-size: 18px; right: 0; position: absolute; z-index: 60000000; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文