好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html中如何让DIV标签中的P标签水平和垂直都居中?

html中如何让DIV标签中的P标签水平和垂直都居中?

<!DOCTYPE html>  
<html>  
<head>  
<meta charset="utf-8" />  
<title>让DIV标签中的P标签水平和垂直都居中</title>  
<style type="text/css">  
div {  
  width:400px;  
  height:300px;  
  border:1px solid #666;  
  overflow:hidden;  
  position:relative;  
  display:table-cell;  
  text-align:center;  
  vertical-align:middle;  
}  
p {  
  border:1px solid #333;  
  width:100%;  
  }  
* { margin:0; padding:0;}  
</style>  
</head>  
<body>  
   
<div>  
<p>我是多行文本,我要水平和垂直都居中。</p>  
<p>且要完全兼容ff和ie。我是多行文本,我要水平和垂直都居中。且要完全兼容ff和ie。</p>  
</div>  
   
</body>  
</html> 

以上就是html中如何让DIV标签中的P标签水平和垂直都居中?的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于html中如何让DIV标签中的P标签水平和垂直都居中?的详细内容...

  阅读:45次