内容简介:translateflex和margin:auto2. 元素为为定宽定高(自身包含尺寸的元素)的元素
display: flex; justify-content:center; align-items:Center;
translate
position: absolute; top:50%; left:50%; width:100%; transform:translate(-50%,-50%); text-align: center;
flex和margin:auto
.box{
display: flex;
text-align: center;
}
.box span{margin: auto;}
2. 元素为为定宽定高(自身包含尺寸的元素)的元素
绝对定位和负边距
position: absolute; width:100px; height: 50px; top:50%; left:50%; margin-left:-50px; margin-top:-25px;
绝对定位和0
原理:当一个绝对定位元素,其对立定位方向属性同时有具体定位数值的时候,流体特性,具有流体特性绝对定位元素的margin:auto的填充规则和普通流体元素一模一样
width: 50%; height: 50%; background: #000; overflow: auto; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0;
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Windows核心编程(第5版)
Jeffrey Richter、Christophe Nasarre / 葛子昂、周靖、廖敏 / 清华大学出版社 / 2008-9 / 99.00元
这是一本经典的Windows核心编程指南,从第1版到第5版,引领着数十万程序员走入Windows开发阵营,培养了大批精英。. 作为Windows开发人员的必备参考,本书是为打算理解Windows的C和C++程序员精心设计的。第5版全面覆盖Windows XP,Windows Vista和Windows Server 2008中的170个新增函数和Windows特性。书中还讲解了Windows......一起来看看 《Windows核心编程(第5版)》 这本书的介绍吧!