box2如何在box1里面居中啊

来源:13-9 Relative与Absolute组合使用

无悔冰魄

2021-03-12 10:05

box2怎么在box1中居中

写回答 关注

3回答

  • qq_慕侠5047639
    2021-03-12 15:33:26
    已采纳

    用css样式即可

  • 慕尼黑6547879
    2021-06-03 16:02:53

        #box2 {

            width:100px;

            height:100px;

            position: absolute;

            top: 25%;

            left: 25%;


        }

  • 慕沐5414594
    2021-05-10 13:12:58

    #box2 {

            width: 100px;

            height: 100px;

            position: absolute;

            left: 50%;

            top: 50%;

            margin-left:-50px; 

            margin-top: -50px;

            text-align:center;


        }


初识HTML(5)+CSS(3)-升级版

HTML(5)+CSS(3)基础教程8小时带领大家步步深入学习标签用法和意义

1223055 学习 · 18212 问题

查看课程

相似问题