CSS - relative positioned parent div not stretching to absolute child div height

后端 未结 5 918
执念已碎
执念已碎 2020-11-28 07:08

I\'ve been googling this all morning and can\'t seem to get it to work:

I have a parent DIV with Relative positioning and a two column child DIV setup inside of it,

5条回答
  •  温柔的废话
    2020-11-28 08:01

    You do not need position: absolute for this task.

    #content {
        width: 780px;
        padding: 10px;
        position: relative;
        background: #8b847d;
    }
    
    #leftcol { 
        width: 500px;
        float: left;
    }
    
    #rightcol {
        width: 270px;
        position: relative;
        margin-left: 510px;
        text-align: center;
    }
    

提交回复
热议问题