标签:style blog color io os ar div sp on
1.采用负边距和position结合方式
<html> <head></head> <body> <style type="text/css"> .big{ position:relative;background:#eee; width:100%;height:100%; } .small{ position:absolute;top:50%;left:50%; width:200px;height:200px;border:1px solid red; margin:-100px 0 0 -100px;background:#fff; } </style> <div class="big"> <div class="small">盒子居中</div> </div> </boyd> </html>
标签:style blog color io os ar div sp on
原文地址:http://www.cnblogs.com/bigdesign/p/3992549.html