Why magin:auto is not enough to center position absolute or fixed?

前端 未结 4 1140
迷失自我
迷失自我 2020-12-12 03:44

I am trying to center the contents of a div, my parent container is set to Relative.

I am using this on the inner div

    position: absolute;
    mar         


        
4条回答
  •  青春惊慌失措
    2020-12-12 04:16

    With right or left (and position: absolute) you are aligning the div absolutely to parent element, in your case with 0 offset. Try to play with their values in developer console in your browser.

提交回复
热议问题