使用绝对定位来做
left和top设置50% 然后margin-left:-盒子宽度的一半margin-top也是-盒子宽度的一半
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.diva {
background-color: red;
width: 100px;
height: 100px;
position: absolute;
left: 50%;
margin-left: -50px;
top: 50%;
margin-top: -50px;
border-radius: 50px;
}
</style>
</head>
<body>
<div class="diva">
</div>
</body>
</html>