开发者

How do I overlay a menu ontop the rest of my site?

I have php generating html and I want to create layers. Basically I want to have a menu overlay without messing up the structure of everything displayed under开发者_StackOverflow it.


Try this:

CSS:

#menuOverlay {
   position:fixed; /*or  absolute*/
   top:0;
   left:0;
   width:100%:
   height:30px;
   background:green;
   z-index: 999; /* or  greater value */
}

HTML:

<div id="menuOverlay">
   menu items here ....
</div>


You need to use CSS keyword z-index. More information and complete tutorial here:
http://www.html.net/tutorials/css/lesson15.asp


In your CSS file -

#overlaymenu {
    z-index: 1000;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 20px;
    background: #000;
    color: #FFF;
}

In your HTML -

<div id="overlaymenu">My menu's content!</div>

Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜