`
micc010
  • 浏览: 69651 次
  • 性别: Icon_minigender_1
  • 来自: 广西
社区版块
存档分类
最新评论

CSS DIV 垂直居中

    博客分类:
  • web
阅读更多
<html>
<head>
<style>  
body {padding: 0; margin: 0;}  
body,html{height: 100%;}  
#outer {height: 100%; overflow: hidden; position: relative;width: 100%; background:#333;}  
#outer[id] {display: table; position: static;}  
#middle {position: absolute; top: 50%;left: 0}  
#middle[id] {display: table-cell; vertical-align: middle; position: static;}  
#inner {position: relative; top: -50%; margin: 0 auto;}  
#content{width:500px; height:400px; border:1px solid red; background:#EEE; margin: 0 auto;}  
</style>
</head>
<body>  
<div id="outer">  
    <div id="middle">  
        <div id="inner">  
             <div id="content">111</div>  
        </div>  
    </div>  
</div>  
</body>
</html>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics