引入
<script src="js/rem.js"></script>
引入rem.js后 样式添加
body{
/*width: 100%;
height: 100%;*/
background-color: #F6F6F6;
font-size: 0.5rem;
text-align: center;
}
font-size: 0.5rem; 会改变界面高度
text-align: center; 在div中使用margin: 0.5rem auto;会居中div
0.5rem是自定义单位
如果想让div居中,在父div中使用text-align: center;
然后在div中使用 margin: 0.5rem auto;
如果在body中设置text-align: center; 会默认居中其中的文字
div如果使用margin: 0.5rem auto;也会居中
如果想居中按钮,在外层加上div,div设置text-align: center;
button设置或不设置margin: 0.5rem auto;都会居中
前提是想居中的文字,div或者按钮等不能再使用text-align ,float等重新设置位置。。。