button position absolute not working as expected

后端 未结 7 1228
礼貌的吻别
礼貌的吻别 2021-02-20 05:49

Can anyone explain why this button is not absolute-positioned to the right? I would expect it to be 3px from every edge.

7条回答
  •  执笔经年
    2021-02-20 06:37

    I think you are trying to put button in center.You declared top and left 3px so no matter what you define bottom and right button is going to to be 3px from top and left ignoring other.To put button in center use marginFirst define width of button and set marginLike thia

    .

    wrapper button{
      Width:100px;
       margin:0px auto;
    

    }

    not margin doesn't work with absolute position.

提交回复
热议问题