Last active
October 4, 2015 14:07
-
-
Save rocketxujia/2650326 to your computer and use it in GitHub Desktop.
高度未知的div实现水平垂直居中
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { margin: 0; padding: 0; } | |
#page{display:table;overflow:hidden;margin:0px auto;} | |
*:first-child+html #page {position:relative;}/*ie7*/ | |
* html #page{position:relative;}/*ie6*/ | |
#content_container{display:table-cell;vertical-align: middle; } | |
*:first-child+html #content_container{position:absolute;top:50%;}/*ie7*/ | |
* html #content_container{position:absolute;top:50%;}/*ie6*/ | |
*:first-child+html #content{position:relative;top:-50%;}/*ie7*/ | |
* html #content{position:relative;top:-50%;}/*ie6*/ | |
html,body{height:100%;} | |
#page{height:100%;width:465px;} | |
#content{ | |
border:1px solid #000; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="page"> | |
<div id="content_container"> | |
<div id="content"> | |
<p>your content</p> | |
<p>your content</p> | |
<p>your content</p> | |
<p>your content</p> | |
</div> | |
</div> | |
</div> | |
<div class="transparent"> | |
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment