跳转至内容
  • 社区首页
  • 版块
  • 最新
  • 标签
  • 热门
折叠

GitHub中文论坛

xiongbofanX

xiongbofan

@xiongbofan
关于
帖子
3
主题
1
分享
0
群组
0
粉丝
1
关注
1

帖子

最新 最佳 有争议的

  • 盒子如何垂直水平居中方法
    xiongbofanX xiongbofan

    盒子垂直水平居中方法:
    1、

    .box{
      position: absolute;
      top:0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
    }
    

    2、使用定位垂直水平居中:负margin居中(传统方法)
    子绝父相

    .father{
      position:relative;
      width:300px;
      height:300px;
    }
    .son{
      position: absolute;
      width:100px;
      height:100px;
      left:50%;
      top:50%
      margin-left: -50%;
      margin-top: -50%;
    }
    

    3.transform居中方法

    .box {
      width: 100px;
      height: 100px;
      position: relative;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
    }
    

    个人觉得比较好用的垂直居中方法,还是定位和transform粗体字

    技术交流

  • 用CSS3实现旋转
    xiongbofanX xiongbofan

    @yangboha 学到了

    技术交流
  • 登录

  • 第一个帖子
    最后一个帖子
0
  • 社区首页
  • 版块
  • 最新
  • 标签
  • 热门