您的位置:首页 > Web前端 > CSS

CSS 水平垂直居中 方法三

2015-09-17 23:43 706 查看
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="../css/style.css"/>
<title></title>
</head>
<body>
<div id="content">
<div><div>居中</div></div>
</div>
</body>
</html>

#content>div{
width: 500px;
height: 400px;
position: fixed;
top: 50%;
left: 50%;
}
#content>div>div{
background-color: red;
text-align: center;
line-height: 400px;
position: relative;
overflow: hidden;
top: -50%;
left: -50%;
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CSS 水平垂直居中