关于居中的系列问题[1]

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
.box{
width:400px;
height:300px;
border:1px solid #f00;
position:absolute;
left:50%;
top:50%;
margin-left:-200px;
margin-top:-150px;
}
.box p{
font-size:16px;
color:red;
font-weight:bold;
text-align:center;
line-height:300px;
}
.box1 p{
}
</style>
</head>
<body>
<div id="" class="box">
<p>已知div的width和height的情况下,单行文本垂直居中</p>
</div>

</body>
</html>

posted @ 2016-05-13 21:09  JesusLi  阅读(92)  评论(0)    收藏  举报