css实现元素水平垂直居中的几种方式?

前言:天天玩手机,整我的都很差了.javascript 1.绝对定位+margin:auto 优点:无需知道子盒宽高,省去计算的麻烦. 原理:子绝父相(子绝父绝也行),设置上下左右定位为0,margin:auto,子盒的margin自动计算.css <style> #father { position: relative; width: 300px; height: 300px; backgrou
相关文章
相关标签/搜索