Scrolling only content div, others should be fixed

后端 未结 7 1336
广开言路
广开言路 2020-12-17 08:15

I have three divs. I need header and left_side divs to be fixed and content div to scroll. I\'ve been searching for solution and found something with overflow and <

7条回答
  •  醉酒成梦
    2020-12-17 09:08

    You can just use position fixed. http://jsfiddle.net/Nrs2u/1/

    #header {
        position: fixed;
        z-index: 2;
        left: 0%;
        top: 0%;
        width: 100%;
        height: 10%;
        background-color: purple;
    }
    #side {
        position: fixed;
        z-index: 2;
        left: 0%;
        top: 10%;
        width: 10%;
        height: 90%;
        background-color: red;
    }
    #body {
        position: absolute;
        left: 10%;
        top: 10%;
        width: 90%;
        height: 300%;
        background-color: orange;
    }
    

提交回复
热议问题