<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.father{
width: 200px;
height: 200px;
border: 1px solid red;
position: relative;
}
.son{
width: 100px;
height: 100px;
background: yellow;
position: absolute;
/*left: 50%;
top: 50%;
transform: translate(-50%,-50%);*/
/*left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;*/
left: 50%;
margin-left: -50px;
top: 50%;
margin-top: -50px;
}
</style>
</head>
<body>
<div class="father">
<div class="son"></div>
</div>
</body>
</html>