黄页网站数据来源,wordpress和dw,手机app ui设计在线网站,连锁加盟1、水平居中我们都知道#xff0c;可以直接用#xff1a; margin:0 auto; 2、垂直居中#xff0c;需要做一点小小的计算#xff0c;关键代码如下#xff1a; height: 600px; position: absolute; top: 50%; margin-top:-300px; 如需水平且垂直居中#xff1a; height: 60… 1、水平居中我们都知道可以直接用 margin:0 auto; 2、垂直居中需要做一点小小的计算关键代码如下 height: 600px; position: absolute; top: 50%; margin-top:-300px; 如需水平且垂直居中 height: 600px; width: 400px; position: absolute; top: 50%; left: 50%; margin:-300px 0 0 -200px; 注首先position必须要绝对定位然后宽高必须设置值最后left/top为50%margin-top为高度的一半margin-left为宽度的一半。 转载于:https://www.cnblogs.com/fifteen718/p/9533902.html