Scrolling only content div, others should be fixed

后端 未结 7 1330
广开言路
广开言路 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 08:50

    • at first you will need to have a fixed height for content area.
    • then make overflow:auto there

    ERROR in your code:: you want to have a scroll bar for a div,but you are declaring that div height as auto

    you cant demand a scroll bar when the height is auto,to have scroll bar you will need to have a fixed height for that div and when the content height will be greater than div height it will introduce scroll bar automatically

    NOTE: so the changes in your css will be

    #content{
     height: 300px;/*..very important if you want scroll bar...*/
     overfow:auto; /*..will introduce scroll bar when needed..*/
     padding: 20px;
     margin-left: 230px;
     margin-right: 20px;
    padding-bottom: 30px
    }
    

    EXAMPLE :: FIDDLE

提交回复
热议问题