How to make div stick to the bottom of parent div?

前端 未结 2 968
抹茶落季
抹茶落季 2020-12-23 17:32

Could anyone please help me making div#bottom stick to the bottom of the parent div, so when I click on the button inside it will allow me to show

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 17:43

    .wrapper{position:relative;}
    .bottom{position:absolute; bottom:0;}
    

    Edited

    Thanks to @centr0 and @T.J Crowder the key thing to understand here is that position:relative in .wrapper will "contain" any element that has position:absolute. It's like declaring boundaries for .bottom. Without position:relative in .wrapper, .bottom would break out of that div

提交回复
热议问题