Position absolute but relative to parent

前端 未结 4 1467
小鲜肉
小鲜肉 2020-11-21 05:33

I have two divs inside another div, and I want to position one child div to the top right of the parent div, and the other child div to the bottom of the parent div using cs

4条回答
  •  野性不改
    2020-11-21 05:57

    Incase someone wants to postion a child div directly under a parent

    #father {
       position: relative;
    }
    
    #son1 {
       position: absolute;
       top: 100%;
    }
    

    Working demo Codepen

提交回复
热议问题