css2D转化让盒子程度垂直居中

2026-09-04 20:07:33/百科/91596 阅读

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%);

}

/*走盒子本身宽度的一半*/



之前想要把一个子盒子挪动到父盒子的

#免责声明#

本站提供的一切资源、教程和内容信息仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络收集整理,版权争议与本站无关。