css3-实现水平垂直居中
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>实现水平垂直居中</title>
<style type="text/css">
.content {
width: 100px;
height: 100px;
background: yellow;
position: absolute;
top: 50%;
left: 50%;
border-radius: 5px;
transform: translate(-50%,-50%);
}
</style>
</head>
<body>
<div class="content"></div>
</body>
</html>
浙公网安备 33010602011771号