原创  html内容垂直、水平居中 收藏

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html> 
<head> 
<title> New Document </title> 
<style>
*{
padding: 0;
margin: 0;
}
html,body{
height: 100%;
}
#outer{
height: 100%;
width: 100%;
display: table;
*position: relative;
*overflow: hidden;
}
#middle{
display: table-cell;
vertical-align: middle;
*position: absolute;
*top: 50%;
}
#inner {
width: 400px;
margin: 0 auto;
*position: relative;
*top: -50%;
}
</style> 
</head> 
<body> 
<div id="outer">
  <div id="middle">
      <div id="inner" style="background: red;height: 500px;">
          <p>asdfasdf</p>
          <p>asdf</p>
      </div>
  </div>
</div>
</body> 
</html>

发表于 @ 2007年09月27日 20:16:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:问题:Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME does not point to the JDK | 新一篇:动态装载js和css

  • 发表评论
  • 评论内容:
  •  
Copyright © llh0223
Powered by CSDN Blog