开发者

divs with z-index & position class

i need your help with div positioning into a page. i have the below divs:

- the header with z-index 10, position absolute, top 0, height 250px, width 100%
- wrapper with margin 0 auto, width 990 and inside
- the menu with z-index 8
- content to the right of the menu with z-index 9 so that i could scroll it below the header.

the problem is that i want the menu to have fixed position and this is not possible cause it is not working for the x-axis as it gets outside wrapper. The code is a little messy right now, but i would like to use menu items to scroll the big colored boxes, below header.

Any ideas?

thanks Sot

//sample image alt text http://www开发者_运维技巧.m-lab.gr/sample.jpg


What you want is possible, but it depends on your css for all related elements... html, body, etc...

Can you post your code or provide a link?

With your image, this is a working example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="pt" dir="ltr">

  <head>
    <title>Fixed Menu and Header - Scrolling Content</title>

        <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

        <style type="text/css">
            html, body{margin:0;padding:0;width:100%;height:100%;}
            div.header {position:fixed;top:0;left:0;z-index:1;width:100%;height:200px;background-color:#787878;}
            div.menu {position:fixed;left:20px;top:220px;width:200px;height:350px;background-color:#9abd63;}
            div.wrapper{float:left;padding-left:260px;padding-top:220px;}
            div.blocks{width:600px;height:300px;margin:5px;}
            div#block1{background-color:#d9c548;}
            div#block2{background-color:#7e4041;}
            div#block3{background-color:#d9c548;}
            div#block4{background-color:#7e4041;}
            div#block5{background-color:#d9c548;}
            div#block6{background-color:#7e4041;}
            div#block7{background-color:#d9c548;}
        </style>

    </head>

    <body>

        <div class="header">This is the Header</div>
        <div class="menu">
            <ul>
                <li>Menu Opt 01</li>
                <li>Menu Opt 02</li>
                <li>Menu Opt 03</li>
                <li>Menu Opt 04</li>
                <li>Menu Opt 05</li>
                <li>Menu Opt 06</li>
                <li>Menu Opt 07</li>
            </ul>
        </div>
        <div class="wrapper">
            <div class="blocks" id="block1">Block 01</div>
            <div class="blocks" id="block2">Block 02</div>
            <div class="blocks" id="block3">Block 03</div>
            <div class="blocks" id="block4">Block 04</div>
            <div class="blocks" id="block5">Block 05</div>
            <div class="blocks" id="block6">Block 06</div>
            <div class="blocks" id="block7">Block 07</div>
        </div>

    </body>
</html>

Just copy and past, it's tested! Hope it helps!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜