欢迎来到宇程资讯网

宇程资讯网

css2D转化让盒子水平垂直居中

时间:2026-06-07 03:27:57 出处:热点阅读(143)

div {

    position: relative;

    width: 500px;

    height: 500px;

    background-color: pink;

}


p {

    position: absolute;

    top: 50%;

    left: 50%;

    width: 200px;

    height: 200px;

    background-color: rgb(216,转化 50, 50);

    transform: translate(-50%, -50%);

}

/*走盒子自己宽度的一半*/



以前想要把一个子盒子移动到父盒子的

分享到:

温馨提示:以上内容和图片整理于网络,仅供参考,希望对您有帮助!如有侵权行为请联系删除!

友情链接: