设为首页 - 加入收藏
您的当前位置:首页 >时尚 >css2D转化让盒子水平垂直居中 正文

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

来源:南凌川网格社区编辑:{typename type="name"/}时间:2026-11-22 22:54:45

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

}

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



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

    1    2  3  4  5  6  7  8  9  10  11  
热门文章

    1.4864s , 8166.46875 kb

    Copyright © 2016 Powered by css2D转化让盒子水平垂直居中 ,南凌川网格社区   sitemap

    Top